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: memberThis 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: contributorThatevent_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 beforeevent_base_loopexitis called?
- 
  
  ken2812221 commented at 6:25 pm on June 17, 2018: contributorshould make sure the reply is handled before threadHTTP loop exit because the loop can exit earlier thanevent_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 0:10 am on August 9, 2018: contributor@MarcoFalke If necessary, I can work on this again.
- 
    
    ken2812221 reopened this on Aug 9, 2018
 
- 
  
  MarcoFalke commented at 12:31 pm on August 10, 2018: memberTested 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
        
        
            
                
                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: 2025-10-31 21:13 UTC
        
    
    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: 2025-10-31 21:13 UTC
        
            This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me