Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThreadRPCServer not finished before exit(0) #2204

Closed
gavinandresen opened this issue Jan 23, 2013 · 4 comments
Closed

ThreadRPCServer not finished before exit(0) #2204

gavinandresen opened this issue Jan 23, 2013 · 4 comments
Labels

Comments

@gavinandresen
Copy link
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...

@Diapolo
Copy link

Diapolo commented Jan 23, 2013

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.

@gavinandresen
Copy link
Contributor Author

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

@sipa
Copy link
Member

sipa commented Apr 23, 2013

@gavinandresen Does this still exist after the threads rework?

@gavinandresen
Copy link
Contributor Author

Closing, fixed by the threads work.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants