startup is not very interruptible (fRequestShutdown) #8064

issue kazcw opened this issue on May 17, 2016
  1. kazcw commented at 5:57 AM on May 17, 2016: contributor

    This mostly only matters when testing, but it takes a long time for Ctrl+C to interrupt anything during initial startup because fRequestShutdown isn't checked much. (Also, fRequestShutdown is currently accessed across threads without synchronization.) We could put in more fRequestShutdown checks but init calls into some long-running main functions that already check for shutdown via boost's interrupt mechanism; a consistent solution would be preferable.

    One approach would be to put everything in boost threads and use boost interruption everywhere (main could join the WaitForShutdown thread rather than calling it in main's thread). AppInit2 doesn't expect interruption and would need modifications to handle that exit path correctly, but the interruption points that already exist in the main code would make startup much more abortable. The consistency with the rest of the code would also be a plus and would allow a better implementation of #8063 that isn't practical with fRequestShutdown.

  2. laanwj commented at 9:25 AM on May 18, 2016: member

    Startup is reasonably interruptible, compared to where we came from. Sure, some phases can still take a while but it used to be much worse.

    Also, fRequestShutdown is currently accessed across threads without synchronization.

    It's a boolean, volatile, and a special signal atomic type. As it is not allowed to lock within a signal handler, this should be enough:

    volatile sig_atomic_t fRequestShutdown = false;
    
  3. jonasschnelli added the label Feature on May 21, 2016
  4. kazcw closed this on Jun 23, 2018

  5. 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: 2026-04-19 00:15 UTC

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