Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Make HTTP server shutdown more graceful #6719
Shutting down the HTTP server currently breaks off all current requests. This can create a race condition with RPC
This change removes the listening sockets on shutdown so that no new requests can come in, but no longer breaks off requests in progress.
Meant to fix #6717.
Note that this solution is cleaner in any case, it doesn't rule out queuing a
@dcousens It's great that you mentioned it. It reminded me of potential issue of this: what happens if a timer is stilll running, will it block the event queue exit until it triggers?
Pushed another related fix:
http: Wait for worker threads to exit
Add a WaitExit() call to http's WorkQueue to make StopHTTPServer delete the work queue only when all worker threads stopped.
This fixes a problem that was reproducable by pressing Ctrl-C during AppInit2:
I was assuming that