Close #11777
This also revert #11006, since event_base_loopexit seems to drop unstarted event. So shutdown might take longer.
Ensure that http event loop is empty before the loop exit #13485
pull ken2812221 wants to merge 1 commits into bitcoin:master from ken2812221:http_shutdown changing 1 files +7 −3-
ken2812221 commented at 11:22 PM on June 16, 2018: contributor
- MarcoFalke added the label RPC/REST/ZMQ on Jun 16, 2018
- ken2812221 renamed this:
Ensure that event loop is empty before the loop exit
Ensure that http event loop is empty before the loop exit
on Jun 17, 2018 - ken2812221 force-pushed on Jun 17, 2018
-
Ensure that event loop is empty before the loop exit 4e79d3e281
- ken2812221 force-pushed on Jun 17, 2018
-
promag commented at 2:18 PM on June 17, 2018: member
This should be simple, I don't think libevent would force such workarounds.
since event_base_loopexit seems to drop unstarted event
According to the documentation it ignores pending events but active events are handled.
And looks like sending the reply is an active event ():
https://github.com/bitcoin/bitcoin/blob/d6cf4bd7eb3b675cdffec9884a6033f41033ad82/src/httpserver.cpp#L583-L608 https://github.com/bitcoin/bitcoin/blob/d6cf4bd7eb3b675cdffec9884a6033f41033ad82/src/httpserver.cpp#L519-L525 Maybe there is a problem in when the the event is activ'ated?
-
ken2812221 commented at 2:48 PM on June 17, 2018: contributor
That
event_activecould be called after threadHTTP exited and the event wouldn't get called in rare case. This can be tested by addingsleep(1)betweenStartShutdown()andreturnstatement. https://github.com/bitcoin/bitcoin/blob/d6cf4bd7eb3b675cdffec9884a6033f41033ad82/src/rpc/server.cpp#L229-L240 -
promag commented at 5:52 PM on June 17, 2018: member
@ken2812221 so instead it should make sure the reply is handled before
event_base_loopexitis called? -
ken2812221 commented at 6:25 PM on June 17, 2018: contributor
should make sure the reply is handled before threadHTTP loop exit because the loop can exit earlier than
event_base_loopexitcalled. However I have no idea how to do that. - ken2812221 closed this on Jun 18, 2018
- ken2812221 deleted the branch on Jun 18, 2018
-
MarcoFalke commented at 9:54 PM on August 8, 2018: member
@ken2812221 Are you still working on this?
- ken2812221 restored the branch on Aug 9, 2018
-
ken2812221 commented at 12:10 AM on August 9, 2018: contributor
@MarcoFalke If necessary, I can work on this again.
- ken2812221 reopened this on Aug 9, 2018
-
DrahtBot commented at 5:06 AM on August 9, 2018: member
<!--e57a25ab6845829454e8d69fc972939a-->Reviewers, this pull request conflicts with the following ones:
- #13501 (Correctly terminate HTTP server by promag)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
-
MarcoFalke commented at 12:31 PM on August 10, 2018: member
Tested 4e79d3e28167ac169f417623f07f48dd3cb0f6ac on current master and could run the tests for 24 hours in a loop. (Which is not possible on current master)
- ken2812221 closed this on Aug 21, 2018
- ken2812221 deleted the branch on Aug 21, 2018
- ken2812221 restored the branch on Aug 24, 2018
- ken2812221 deleted the branch on Sep 20, 2018
- ken2812221 restored the branch on Oct 2, 2018
- ken2812221 reopened this on Oct 2, 2018
- ken2812221 force-pushed on Oct 3, 2018
- ken2812221 force-pushed on Oct 3, 2018
- ken2812221 closed this on Oct 13, 2018
- ken2812221 deleted the branch on Oct 13, 2018
- DrahtBot locked this on Sep 8, 2021