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
  1. ken2812221 commented at 11:22 pm on June 16, 2018: contributor
    Close #11777 This also revert #11006, since event_base_loopexit seems to drop unstarted event. So shutdown might take longer.
  2. MarcoFalke added the label RPC/REST/ZMQ on Jun 16, 2018
  3. 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
  4. ken2812221 force-pushed on Jun 17, 2018
  5. Ensure that event loop is empty before the loop exit 4e79d3e281
  6. ken2812221 force-pushed on Jun 17, 2018
  7. 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?

  8. ken2812221 commented at 2:48 pm on June 17, 2018: contributor
    Thatevent_active could be called after threadHTTP exited and the event wouldn’t get called in rare case. This can be tested by adding sleep(1) between StartShutdown() and return statement. https://github.com/bitcoin/bitcoin/blob/d6cf4bd7eb3b675cdffec9884a6033f41033ad82/src/rpc/server.cpp#L229-L240
  9. 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_loopexit is called?
  10. 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_loopexit called. However I have no idea how to do that.
  11. ken2812221 closed this on Jun 18, 2018

  12. ken2812221 deleted the branch on Jun 18, 2018
  13. MarcoFalke commented at 9:54 pm on August 8, 2018: member
    @ken2812221 Are you still working on this?
  14. ken2812221 restored the branch on Aug 9, 2018
  15. ken2812221 commented at 0:10 am on August 9, 2018: contributor
    @MarcoFalke If necessary, I can work on this again.
  16. ken2812221 reopened this on Aug 9, 2018

  17. DrahtBot commented at 5:06 am on August 9, 2018: member
    • #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.

  18. 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)
  19. ken2812221 closed this on Aug 21, 2018

  20. ken2812221 deleted the branch on Aug 21, 2018
  21. ken2812221 restored the branch on Aug 24, 2018
  22. ken2812221 deleted the branch on Sep 20, 2018
  23. ken2812221 restored the branch on Oct 2, 2018
  24. ken2812221 reopened this on Oct 2, 2018

  25. ken2812221 force-pushed on Oct 3, 2018
  26. ken2812221 force-pushed on Oct 3, 2018
  27. ken2812221 closed this on Oct 13, 2018

  28. ken2812221 deleted the branch on Oct 13, 2018
  29. DrahtBot locked this on Sep 8, 2021

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: 2024-11-18 00:12 UTC

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