HomePhabricator

http: Wait for worker threads to exit
de9de2de361aUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

http: Wait for worker threads to exit

Add a WaitExit() call to http's WorkQueue to make it delete the work
queue only when all worker threads stopped.

This fixes a problem that was reproducable by pressing Ctrl-C during
AppInit2:

/usr/include/boost/thread/pthread/condition_variable_fwd.hpp:81: boost::condition_variable::~condition_variable(): Assertion `!ret' failed.
/usr/include/boost/thread/pthread/mutex.hpp:108: boost::mutex::~mutex(): Assertion `!posix::pthread_mutex_destroy(&m)' failed.

I was assuming that threadGroup->join_all(); would always have been
called when entering the Shutdown(). However this is not the case in
bitcoind's AppInit2-non-zero-exit case "was left out intentionally
here".

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Sep 25 2015, 11:49
deadalnixPushed on May 14 2017, 22:04
Parents
rABC5e0c22135600: Make HTTP server shutdown more graceful
Branches
Unknown
Tags
Unknown

Event Timeline

Wladimir J. van der Laan <laanwj@gmail.com> committed rABCde9de2de361a: http: Wait for worker threads to exit (authored by Wladimir J. van der Laan <laanwj@gmail.com>).Sep 28 2015, 13:06