Cuberite Forum

Full Version: [FIXED] I found a deadlock
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A quick overview of what thread locks what criticalsection
Code:
ServerTickThread
Owns cServer::m_CSClients
Wait cSocketThreads::m_CS

cSocketThread
Owns cSocketThreads::m_CS
Wait cServer::m_CSClients

cServer::ServerListenThread
Wait cSocketThreads::m_CS // Doesn't really matter, but it blocks new clients

The deadlock is between ServerTickThread and cSocketThread

ServerTickThread callstack:
[Image: Screenshot-2012-03-04_14.13.04.png]


cSocketThread callstack:
[Image: Screenshot-2012-03-04_14.14.23.png]
I guess client deleting can be done postponed - in the TickThread make a list of clients to be deleted, move clients to that list while the CS is locked, then unlock the CS and delete clients from the list.
I fixed your deadlock (rev 369)