yavl / teeworlds-infclassR

Slightly modified version of official InfClass
Other
10 stars 4 forks source link

Server crash with hero indicator enabled #92

Closed bretonium closed 5 years ago

bretonium commented 5 years ago

Steps to reproduce:

  1. Enable flag indicator
  2. Several people took heroes

Unfortunately, i could not capture the exception that happened and have only the following trace:

#1  0x0000563931709896 in CCharacter::Snap (this=0x5639319ddf18 <ms_PoolDataCCharacter+8440>, SnappingClient=5) at src/game/server/entities/character.cpp:3133
#2  0x00005639316d1c56 in CGameWorld::Snap (this=0x7f13973e3178, SnappingClient=5) at src/game/server/gameworld.cpp:114
#3  0x00005639316eeb3c in CGameContext::OnSnap (this=0x7f13973e0010, ClientID=5) at src/game/server/gamecontext.cpp:4213
#4  0x00005639316a510b in CServer::DoSnapshot (this=0x7f1392123010) at src/engine/server/server.cpp:856
#5  0x00005639316ab1b1 in CServer::Run (this=0x7f1392123010) at src/engine/server/server.cpp:2234
#6  0x00005639316ae0e7 in main (argc=1, argv=0x7fff7fbe5e68) at src/engine/server/server.cpp:2862

On my server line numbers are a little different because of few modifications. Corresponding lines (they are the same as upstream): https://github.com/bretonium/my-infclass-server/blob/test-master/src/game/server/entities/character.cpp#L3133

duralakun commented 5 years ago

Ok so the pointer to the hero flag seems to be null. This crash happens inside the Snap function. Here the hero flags will be created: (inside the Tick function) https://github.com/bretonium/my-infclass-server/blob/test-master/src/game/server/entities/character.cpp#L2419 So if the hero flag is null inside the Tick function a new one should be created Hero flags will be delted here: (inside destroy ChildEntities function) https://github.com/bretonium/my-infclass-server/blob/test-master/src/game/server/entities/character.cpp#L3744

duralakun commented 5 years ago

I added a null pointer check: https://github.com/yavl/teeworlds-infclassR/commit/4a29b7848017352149d61866d55564a4223e466c Maybe the problem was that the snap would happen before the tick happens right after a player chooses a hero. Or maybe there is some other unknown bug.