Bitcoin should shut itself down or cancel system shutdown if system is shutdown while running #4036

issue maqifrnswa opened this issue on April 9, 2014
  1. maqifrnswa commented at 3:40 PM on April 9, 2014: contributor

    If a user shutdowns their system while bitcoin-qt is running, they receive the pop-up window that says, "Bitcoin Core is shutting down..." "Do not shut down the computer until this window disappears."

    However, by the time the pop-up shows, the user has already shutdown the system and is thinking that that they may have caused a problem.

    Should the second line say, "Do not power off the computer until this window disappears." Or should there be a warning to never shutdown your computer while bitcoin-qt is running?

    shutdown message here: https://github.com/bitcoin/bitcoin/blob/master/src/qt/utilitydialog.cpp#L126

  2. laanwj commented at 6:01 PM on April 9, 2014: member

    The message is accurate. Shutting down your computer while bitcoin is running can be dangerous. If it is not shut down properly, the database (or even wallet) may be left in a corrupted state.

  3. laanwj added the label GUI on Apr 9, 2014
  4. ghost commented at 7:33 PM on April 9, 2014: none

    Maybe you could use QtCloseEvent to prevent windows program termination during important tasks. This way when program close is requested it can prevent termination during the bitcoin shutdown tasks, then release control.

  5. maqifrnswa commented at 8:14 PM on April 9, 2014: contributor

    Thanks - yes, it's more than just the message. The problem is that a user hits shutdown, then the user sees the message that they should not have done it. Like @drak said, can we make bitcoin stall shutdown so it can finish? See: QSessionManager::cancel () https://qt-project.org/doc/qt-4.7/qsessionmanager.html#id-df0f5c47-b430-4fdb-8ef2-d1214a82b61f "Tells the session manager to cancel the shutdown process. Applications should not call this function without asking the user first. See also allowsInteraction() and allowsErrorInteraction()."

    I'd suggest popping up a window with "Shutdown bitcoin or cancel system log off?" with an "ok" and "cancel" button if allowsInteraction() is true. "ok" triggers normal bitcoin close, "cancel" triggers QSessionManager:cancel(). It won't prevent remote shutdowns, but if allowsInteraction() is true, it will stop users from shutting down accidentally.

    EDIT: an example of catching the shutdown signal and cancelling it is here: http://qt.developpez.com/doc/4.7/qsessionmanager/#allowsinteraction

  6. maqifrnswa renamed this:
    Shutdown message possibly innacurate
    Bitcoin should shut itself down or cancel system shutdown if system is shutdown while running
    on Apr 9, 2014
  7. Diapolo commented at 8:48 PM on April 9, 2014: none

    I have got working code for this at least for Windows, I'll create a patch tomorrow for review :).

  8. ghost commented at 9:01 PM on April 9, 2014: none

    For *nix implement callback signal(SIGINT, sigint_callback) via signal.h & errno.h would work does Windows use this? then you are already done? :-)

    On Wed, Apr 9, 2014 at 4:49 PM, P. Kaufmann notifications@github.comwrote:

    I have got working code for this at least for Windows, I'll create a patch tomorrow for review :).

    Reply to this email directly or view it on GitHubhttps://github.com/bitcoin/bitcoin/issues/4036#issuecomment-40014486 .

    Jourdain Casale Lead Computer Scientist | Advanced Research Projects | CASCORP Direct: +1 (647) 505-5919

    This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.

    -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: GPGTools - https://gpgtools.org

    mQENBFMslfEBCADPHwWP4QOLRNSRvmfhNSaz9L/pItzvJV/sq6kfNzu7su+Ng74+ o8pa7cq/MPvZnNlc/+jWprS8Z+kzrqA7Yq0vInQsTEGF8iI72kSDZOy/7vPyjtUK fn9tXThmTQOgeHc6aNt2cU0MAjHZPuOIBpV7UJoqZ7qwbss8cl5n+FjuAJ8DlGee yH/12NdF/CMW/icKz1yMZHk2mg28CV2QNPH44N1Xm6AtqTMp8JARrImMxD75Djft spxi/cylHFj8J7mcG385fymT7K2711IchwEc3via/9yP0wooUrOTQHJE8jsAvW8j +kLG2W5918Sl/uCUfeHIN3AqVzMCr/uHSkD5ABEBAAG0JUpvdXJkYWluIENhc2Fs ZSA8Y2FzYWxlakBjYXNjb3JwLm5ldD6JAT0EEwEKACcFAlMslfECGwMFCQ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ZtQiFqxqsBm+Sg+d9C//48bnfmAusUR//5f lSU0WF03e7NL6CDAsYQInJaLEnWel129d2ODqkrUvGDRC0aShrbjmIrmuENksIQ= =tsNb -----END PGP PUBLIC KEY BLOCK-----

  9. gmaxwell commented at 10:30 PM on April 9, 2014: contributor

    If it's possible to hold the windows shutdown it should be done in a non-QT specific way because the gui-less daemon also needs to close itself completely. I'm unsure if we have any more remaining issues where shutdown will take more than a few seconds— we probably do.

  10. laanwj commented at 5:54 AM on April 10, 2014: member

    @gmaxwell Several, at least these I know of:

    #3966 Client keeps updating tip after Shutdown requested #2954 Opencon thread massively slows down client shutdown

    It could be frustrating to hold up shutdown in this case, though it's certainly better than forcing shutting down and possibly breaking something.

  11. laanwj closed this on Apr 27, 2014

  12. 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-14 21:15 UTC

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