ThreadRPCServer not finished before exit(0) #2204

issue gavinandresen opened this issue on January 23, 2013
  1. gavinandresen commented at 2:33 AM on January 23, 2013: contributor

    I found this debugging a crash-on-exit running the latest code on Windows XP.

    Sending bitcoind the RPC 'stop' command, I see the following "Thread exited" messages:

    2013-01-22 19:35:01 ThreadRPCServer method=stop 2013-01-22 19:35:03 ThreadSocketHandler exited 2013-01-22 19:35:04 ThreadOpenConnections exited 2013-01-22 19:35:04 ThreadMessageHandler exited 2013-01-22 19:35:04 StopNode() 2013-01-22 19:35:09 Bitcoin exited

    There should be a ThreadRPCServer exited message there before 'Bitcoin exited'

    I'm 90% sure the crash on Windows is happening in ThreadRPCServer, decrementing vnThreadsRunning[THREAD_RPCLISTENER]. I suspect the vnThreadsRunning destructor is being called before ThreadRPCServer2 returns, because ThreadRPCServer2 is waiting inside io_service.run_one()

    The entire threads/fShutdown/StartShutdown()/Shutdown() scheme is fragile and a big mess, and should be cleaned up. Not for the 0.8 release, though...

  2. Diapolo commented at 7:02 AM on January 23, 2013: none

    ACK to cleaning that up, I always see that shutdown code and wonder how that is working anyway ^^. Even all that little sleeps() in there or the exit thread... some things look rather weird.

  3. gavinandresen commented at 6:07 PM on February 10, 2013: contributor

    Two more crash-on-exit reports in the rc1 thread: https://bitcointalk.org/index.php?topic=142151

  4. sipa commented at 11:17 PM on April 23, 2013: member

    @gavinandresen Does this still exist after the threads rework?

  5. gavinandresen commented at 3:55 PM on April 30, 2013: contributor

    Closing, fixed by the threads work.

  6. gavinandresen closed this on Apr 30, 2013

  7. DrahtBot locked this on Sep 8, 2021
Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-20 00:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me