Skip to content

Instantly share code, notes, and snippets.

@snicolet
Last active September 18, 2019 22:43
Show Gist options
  • Save snicolet/59686f8db4055be1a579d08a65417e4c to your computer and use it in GitHub Desktop.
Save snicolet/59686f8db4055be1a579d08a65417e4c to your computer and use it in GitHub Desktop.
Example of output of the deterministic hang on 1 thread:
a) compile with USE_CUSTOM_CONDITION_VARIABLE = 1
b) type the commands
./stockfish
bench <--- doesn't run
stop <--- doesn't work
quit <--- doesn't work
^C
===============================================================
23:26:21 > ./stockfish
[DEBUG_HANG] entering main()...
Stockfish 180919 64 POPCNT by T. Romstad, M. Costalba, J. Kiiski, G. Linscott
[DEBUG_HANG] entering ThreadPool::set with requested = 1 and size = 0
[DEBUG_HANG] ThreadPool::set has requested > 0 and is constructing the main thread...
[DEBUG_HANG] Thread 0 is entering idle_loop()...
[DEBUG_HANG] Thread 0 is calling notify_one() in idle_loop(), searching = 0
[DEBUG_HANG] Thread 0 entering notify_one()
[DEBUG_HANG] Thread 0 exiting notify_one()
[DEBUG_HANG] Thread 0 is after notify_one() in idle_loop(), searching = 0
[DEBUG_HANG] Thread 0 is calling cv.wait() in idle_loop(), searching = 0
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 0 will sleep for 1000ms in wait()
[DEBUG_HANG] Entering constructor of thread 0, called by ThreadPool::set (case 2)...
[DEBUG_HANG] Constructor of thread 0 is calling wait_for_search_finished()...
[DEBUG_HANG] Thread 0 is entering wait_for_search_finished(), called by constructor
[DEBUG_HANG] Thread 0 is calling cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 0 exiting wait()
[DEBUG_HANG] Thread 0 is after cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 is existing wait_for_search_finished(), called by constructor
[DEBUG_HANG] Constructor of thread 0 is after the call of wait_for_search_finished()...
[DEBUG_HANG] Exiting constructor of thread 0, called by ThreadPool::set (case 2)...
[DEBUG_HANG] Thread 0 is entering wait_for_search_finished(), called by TranspositionTable::resize
[DEBUG_HANG] Thread 0 is calling cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 0 exiting wait()
[DEBUG_HANG] Thread 0 is after cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 is existing wait_for_search_finished(), called by TranspositionTable::resize
[DEBUG_HANG] exiting ThreadPool::set with requested = 1
[DEBUG_HANG] entering Search::clear...
[DEBUG_HANG] Search::clear is calling wait_for_search_finished() for main thread...
[DEBUG_HANG] Thread 0 is entering wait_for_search_finished(), called by Search::clear
[DEBUG_HANG] Thread 0 is calling cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 0 exiting wait()
[DEBUG_HANG] Thread 0 is after cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 is existing wait_for_search_finished(), called by Search::clear
[DEBUG_HANG] Search::clear is after wait_for_search_finished() for main thread...
[DEBUG_HANG] exiting Search::clear...
[DEBUG_HANG] Thread 999999 is entering idle_loop()...
[DEBUG_HANG] Thread 999999 is calling notify_one() in idle_loop(), searching = 0
[DEBUG_HANG] Thread 999999 entering notify_one()
[DEBUG_HANG] Thread 999999 exiting notify_one()
[DEBUG_HANG] Thread 999999 is after notify_one() in idle_loop(), searching = 0
[DEBUG_HANG] Thread 999999 is calling cv.wait() in idle_loop(), searching = 0
[DEBUG_HANG] Thread 999999 entering wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Entering constructor of thread 999999, called by UCI::loop...
[DEBUG_HANG] Constructor of thread 999999 is calling wait_for_search_finished()...
[DEBUG_HANG] Thread 999999 is entering wait_for_search_finished(), called by constructor
[DEBUG_HANG] Thread 999999 is calling cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 999999 entering wait()
[DEBUG_HANG] Thread 999999 exiting wait()
[DEBUG_HANG] Thread 999999 is after cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 999999 is existing wait_for_search_finished(), called by constructor
[DEBUG_HANG] Constructor of thread 999999 is after the call of wait_for_search_finished()...
[DEBUG_HANG] Exiting constructor of thread 999999, called by UCI::loop...
[DEBUG_HANG] Thread 0 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 0 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 0 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 0 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
bench
[DEBUG_HANG] entering ThreadPool::set with requested = 1 and size = 1
[DEBUG_HANG] ThreadPool::set has size() >0 and is calling wait_for_search_finished() for the main thread...
[DEBUG_HANG] Thread 0 is entering wait_for_search_finished(), called by ThreadPool::set (case 1)
[DEBUG_HANG] Thread 0 is calling cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 0 exiting wait()
[DEBUG_HANG] Thread 0 is after cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 is existing wait_for_search_finished(), called by ThreadPool::set (case 1)
[DEBUG_HANG] ThreadPool::set has size() > 0 and is after the call to wait_for_search_finished() for the main thread...
[DEBUG_HANG] Entering destructor of thread 0...
[DEBUG_HANG] Destructor of thread 0 is raising the exit flag...
[DEBUG_HANG] Thread 0 is calling notify_one() in start_searching(), searching = 1
[DEBUG_HANG] Thread 0 entering notify_one()
[DEBUG_HANG] Thread 0 exiting notify_one()
[DEBUG_HANG] Thread 0 is after notify_one() in start_searching(), searching = 1
[DEBUG_HANG] Thread 0 exiting wait()
[DEBUG_HANG] Thread 0 is after cv.wait() in idle_loop(), searching = 1
[DEBUG_HANG] Thread 0 exiting idle_loop() because exit flag is true...
[DEBUG_HANG] Exiting destructor of thread 0...
[DEBUG_HANG] ThreadPool::set has requested > 0 and is constructing the main thread...
[DEBUG_HANG] Thread 0 is entering idle_loop()...
[DEBUG_HANG] Thread 0 is calling notify_one() in idle_loop(), searching = 0
[DEBUG_HANG] Thread 0 entering notify_one()
[DEBUG_HANG] Thread 0 exiting notify_one()
[DEBUG_HANG] Thread 0 is after notify_one() in idle_loop(), searching = 0
[DEBUG_HANG] Thread 0 is calling cv.wait() in idle_loop(), searching = 0
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 0 will sleep for 1000ms in wait()
[DEBUG_HANG] Entering constructor of thread 0, called by ThreadPool::set (case 2)...
[DEBUG_HANG] Constructor of thread 0 is calling wait_for_search_finished()...
[DEBUG_HANG] Thread 0 is entering wait_for_search_finished(), called by constructor
[DEBUG_HANG] Thread 0 is calling cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 0 exiting wait()
[DEBUG_HANG] Thread 0 is after cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 is existing wait_for_search_finished(), called by constructor
[DEBUG_HANG] Constructor of thread 0 is after the call of wait_for_search_finished()...
[DEBUG_HANG] Exiting constructor of thread 0, called by ThreadPool::set (case 2)...
[DEBUG_HANG] Thread 0 is entering wait_for_search_finished(), called by TranspositionTable::resize
[DEBUG_HANG] Thread 0 is calling cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 0 exiting wait()
[DEBUG_HANG] Thread 0 is after cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 is existing wait_for_search_finished(), called by TranspositionTable::resize
[DEBUG_HANG] exiting ThreadPool::set with requested = 1
[DEBUG_HANG] Thread 0 is entering wait_for_search_finished(), called by TranspositionTable::resize
[DEBUG_HANG] Thread 0 is calling cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 0 exiting wait()
[DEBUG_HANG] Thread 0 is after cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 is existing wait_for_search_finished(), called by TranspositionTable::resize
[DEBUG_HANG] entering Search::clear...
[DEBUG_HANG] Search::clear is calling wait_for_search_finished() for main thread...
[DEBUG_HANG] Thread 0 is entering wait_for_search_finished(), called by Search::clear
[DEBUG_HANG] Thread 0 is calling cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 0 exiting wait()
[DEBUG_HANG] Thread 0 is after cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 is existing wait_for_search_finished(), called by Search::clear
[DEBUG_HANG] Search::clear is after wait_for_search_finished() for main thread...
[DEBUG_HANG] exiting Search::clear...
Position: 1/42
[DEBUG_HANG] ThreadPool::start_thinking is calling wait_for_search_finished() for the main thread...
[DEBUG_HANG] Thread 0 is entering wait_for_search_finished(), called by ThreadPool::start_thinking
[DEBUG_HANG] Thread 0 is calling cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 0 exiting wait()
[DEBUG_HANG] Thread 0 is after cv.wait() in wait_for_search_finished(), searching = 0
[DEBUG_HANG] Thread 0 is existing wait_for_search_finished(), called by ThreadPool::start_thinking
[DEBUG_HANG] ThreadPool::start_thinking is calling wait_for_search_finished() for the main thread...
[DEBUG_HANG] Thread 0 is calling notify_one() in start_searching(), searching = 1
[DEBUG_HANG] Thread 0 entering notify_one()
[DEBUG_HANG] Thread 0 exiting notify_one()
[DEBUG_HANG] Thread 0 is after notify_one() in start_searching(), searching = 1
[DEBUG_HANG] Thread 0 is entering wait_for_search_finished(), called by bench()
[DEBUG_HANG] Thread 0 is calling cv.wait() in wait_for_search_finished(), searching = 1
[DEBUG_HANG] Thread 0 entering wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
stop
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
quit
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
[DEBUG_HANG] Thread 999999 will sleep for 1000ms in wait()
^C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment