[FIXED] std::list asserted in cChunkMap::RemoveClientFromChunks()
#1
I'm kinda confused why it asserted

[Image: Screenshot-2012-02-27_20.10.08.png]
As you can see it didn't like the ++itr part in cChunkMap::RemoveClientFromChunks(), which is strange, because a_Chunks is empty

[Image: Screenshot-2012-02-27_20.14.43.png]

To me this means:
1. cClientHandle::m_LoadedChunks has been altered by another thread, but the criticalsection for m_LoadedChunks was locked and owned by the current thread.

2. The line GetChunkNoGen(...)->RemoveClient(a_Client) in cChunkMap::RemoveClientFromChunks() changed cClientHandle::m_LoadedChunks. But upon inspection this does not happen

So, wtf?

By the way, I seem to have a shitload of SendThreads (hundreds) ?!?
[Image: Screenshot-2012-02-27_20.20.11.png]
[Image: Screenshot-2012-02-27_20.21.07.png]368 threads yo~

Using revision 326
Reply
Thanks given by:
#2
What was the assert message? That's the most important diagnostic.

SendThreads should be eliminated now (rev 328+) since sending uses cSocketThreads now.

I think I remember fixing one place where the m_LoadedChunks list was accessed without proper locking, though I don't really recall where or when. It would explain a lot Smile
Reply
Thanks given by:
#3
Actually I now think the destructor cleared it

Code:
void cClientHandle::Destroy()
{
    m_bDestroyed = true;
    
    if ((m_Player != NULL) && (m_Player->GetWorld() != NULL))
    {
        RemoveFromAllChunks();
    }
}

m_bDestroyed is set first, but it's done from the SendThread. The tick thread comes along, sees the flag m_bDestroyed is true, and deletes the client.

Thoughts?
Reply
Thanks given by:
#4
This might actually be the case. And it might also be the cause for the crashes we get reported "from russia".

Setting m_bDestroyed to true as the last thing Destroy() does should fix that.
I'll do it.
Yeah, destructor didn't lock m_CSChunkLists, so it could have done that. Fixing both.
Reply
Thanks given by:




Users browsing this thread: 3 Guest(s)