Hello once again everyone. I apologize for my absence, but my internet access is very limited this summer (interning with Lockheed Martin).
I've been working on my own server for quite a while now, and truth be told it isn't too far along. However, I've hit kind of a strange wall. I want it to run in cygwin due to my lack of internet connectivity. It compiles and runs, but any time I try to quit out it dies on me with this stackdump:
$ cat BattleMUD.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=00407869
eax=102026C0 ebx=00000000 ecx=61106B24 edx=3E312E34 esi=611001A0 edi=00419A80
ebp=0022CA98 esp=0022CA70 program=C:\cygwin\home\Nick\battle_trunk_svn\src\BattleMUD.exe, pid 2964, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame Function Args
0022CA98 00407869 (10202398, 102026C0, 00000000, 10202A04)
0022CB28 004075BA (10202398, 00000005, 00000BB8, 00457F68)
0022CBA8 00408AA0 (10202398, 1020245C, 0045B5DC, 00000BB8)
0022CC98 00409424 (00000001, 10201E30, 10200090, 61166990)
0022CD98 61006198 (00000000, 0022CDD0, 61005510, 0022CDD0)
61005510 61004416 (0000009C, A02404C7, E8611001, FFFFFF48)
416634 [main] BattleMUD 2964 _cygtls::handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
423101 [main] BattleMUD 2964 _cygtls::handle_exceptions: Error while dumping state (probably corrupted stack)
The odd thing is that this code has never been a problem on my host machine (which runs some flavor of Fedora). Since I have no internet access regularly, I'll provide some clues with code. GDB intercepted the seg fault:
Program received signal SIGSEGV, Segmentation fault.
0x00407869 in Server::ClosePlayer (this=0x10202398, pPlayer=<incomplete type>) at server.cpp:281
281 delete (cPlayer*)pPlayer;
(gdb) bt
#0 0x00407869 in Server::ClosePlayer (this=0x10202398, pPlayer=<incomplete type>) at server.cpp:281
#1 0x004075ba in Server::ProcessPlayers (this=0x10202398) at server.cpp:199
#2 0x00408aa0 in Server::Run (this=0x10202398) at server.cpp:450
#3 0x00409424 in main (argc=1, argv=0x10201e30) at main.cpp:88
(gdb) frame 1
#1 0x004075ba in Server::ProcessPlayers (this=0x10202398) at server.cpp:199
199 ClosePlayer(player);
(gdb) list
194 {
195 player = i->second;
196
197 // if we are logging off or have no socket, go ahead and delete
198 if ( player->GetLogOff() || !player->ValidSocket() )
199 ClosePlayer(player);
200 else // Process input
201 {
202 std::string str = player->GetInCommand();
203
(gdb)
204 // Send the string to the command handler
205 if ( !str.empty() )
206 player->Handle( str );
207
208 // Command has been run, clear it
209 player->ClrInCommand();
210 }
211 }
212 }
213
(gdb) frame 0
#0 0x00407869 in Server::ClosePlayer (this=0x10202398, pPlayer=<incomplete type>) at server.cpp:281
281 delete (cPlayer*)pPlayer;
(gdb) list 275
270 }
271
272 // Correctly remove a player from the server
273 void Server::ClosePlayer(cPlayer *pPlayer)
274 {
275 if ( pPlayer )
276 {
277 // remove from list
278 players.erase(pPlayer->GetID());
279
(gdb)
280 // delete
281 delete (cPlayer*)pPlayer;
282 }
283 else
284 LOG_ERROR("Server::ClosePlayer", "%s", "Null Player Provided" );
285 }
286
287 void Server::Accept()
288 {
289 cSocket *pSocket;
(gdb)
Toss out some ideas. If you want more code I can show it, but there is some more subtle problem here as the code runs quite well on the host machine. |