#20 Spawn removed while being processed for spawn condition

Closed
opened 4 years ago by image · 2 comments
image commented 4 years ago

A spawn being removed while the spawn condition for day/night is being triggered causes a crash on SpawnConditionID().. because the itr->second is null

void ZoneServer::ProcessSpawnConditional(int8 condition) {
MSpawnLocationList.readlock(__FUNCTION__, __LINE__);
MSpawnList.readlock(__FUNCTION__, __LINE__);
map<int32, Spawn*>::iterator itr;
for (itr = spawn_list.begin(); itr != spawn_list.end(); itr++) {
        SpawnLocation* loc = spawn_location_list[itr->second->GetSpawnLocationID()];()];
    // we crash here ^^^ on itr->second = NULL

Our setting of NULL to a spawn ID on spawn removal is not ideal, we should erase from the spawn list...

A spawn being removed while the spawn condition for day/night is being triggered causes a crash on SpawnConditionID().. because the itr->second is null void ZoneServer::ProcessSpawnConditional(int8 condition) { MSpawnLocationList.readlock(__FUNCTION__, __LINE__); MSpawnList.readlock(__FUNCTION__, __LINE__); map<int32, Spawn*>::iterator itr; for (itr = spawn_list.begin(); itr != spawn_list.end(); itr++) { SpawnLocation* loc = spawn_location_list[itr->second->GetSpawnLocationID()];()]; // we crash here ^^^ on itr->second = NULL Our setting of NULL to a spawn ID on spawn removal is not ideal, we should erase from the spawn list...
image referenced this issue from a commit 4 years ago
image commented 4 years ago
Collaborator

trace I had received on this event:

 EQ2World__Debug_x64.exe!Spawn::GetSpawnLocationID() Line 1112    C++
 EQ2WorldDebug_x64.exe!ZoneServer::ProcessSpawnConditional(unsigned char condition) Line 6983    C++
 EQ2WorldDebug_x64.exe!ZoneServer::Process() Line 1420    C++
 EQ2WorldDebug_x64.exe!ZoneLoop(void * tmp) Line 6146    C++
 EQ2WorldDebug_x64.exe!thread_start<void (__cdecl*)(void *),0>(void * const parameter) Line 102    C++
trace I had received on this event: EQ2World__Debug_x64.exe!Spawn::GetSpawnLocationID() Line 1112 C++ EQ2WorldDebug_x64.exe!ZoneServer::ProcessSpawnConditional(unsigned char condition) Line 6983 C++ EQ2WorldDebug_x64.exe!ZoneServer::Process() Line 1420 C++ EQ2WorldDebug_x64.exe!ZoneLoop(void * tmp) Line 6146 C++ EQ2WorldDebug_x64.exe!thread_start<void (__cdecl*)(void *),0>(void * const parameter) Line 102 C++
image commented 4 years ago
Collaborator

As another note the process thats supposed to clean up these dead spawn pointers is

pending_spawn_list_remove inside bool ZoneServer::SpawnProcess() ... however with that delay in place between the removal of the null entry and this ProcessSpawnConditional missing a NULL check on itr->second we ran into the crash.

As another note the process thats supposed to clean up these dead spawn pointers is pending_spawn_list_remove inside bool ZoneServer::SpawnProcess() ... however with that delay in place between the removal of the null entry and this ProcessSpawnConditional missing a NULL check on itr->second we ran into the crash.
Sign in to join this conversation.
Loading...
Cancel
Save
There is no content yet.