gui: Try shutdown also on failure#13880
Conversation
|
Might fix #12337 |
|
Concept ACK |
src/qt/bitcoin.cpp
Outdated
There was a problem hiding this comment.
Add try/catch here instead? Otherwise should fix indentation above.
src/qt/bitcoin.cpp
Outdated
There was a problem hiding this comment.
Could log something? Same below.
There was a problem hiding this comment.
Any suggestions? Note that I'd rather not write to the debug.log, since that might be the cause of the exception.
There was a problem hiding this comment.
I tend to agree that blanket-ignoring exceptions is very bad. Even printing to stderr would be better to at least have a potential chance of someone diagnosing of seeing the error!
There was a problem hiding this comment.
The gui is not always started from the command line, so that would be missed often as well. But I guess I could add it.
|
Concept ACK |
|
Added a commit to print the exception (per common request) |
ryanofsky
left a comment
There was a problem hiding this comment.
This PR is confusing and I think it is trying to do too many things. It would be easier to understand smaller PRs targeted at specific, reproducible problems.
src/qt/bitcoin.cpp
Outdated
There was a problem hiding this comment.
I don't think it is right to call appShutdown() here because it should be covered by return quit(); below. quit should cause the first application loop to quit, which should trigger requestShutdown():
Lines 718 to 720 in 59ecacf
which should trigger requestedShutdown():
Lines 404 to 431 in 59ecacf
which should trigger BitcoinCore::shutdown:
Line 379 in 59ecacf
which already calls appShutdown():
Lines 268 to 281 in 59ecacf
The shutdown process is definitely overcomplicated and should be simplified. I think a good direction would be to stop calling QApplication::quit during shutdown and instead just call it after. So Qt shutdown would just immediately follow bitcoin shutdown instead of being mingled with it.
src/qt/bitcoin.cpp
Outdated
There was a problem hiding this comment.
Could call PrintExceptionContinue(nullptr) in these empty catches. boost::current_exception_diagnostic_information() could also be used to add more detail.
src/qt/bitcoin.cpp
Outdated
There was a problem hiding this comment.
This doesn't seem like the right place to be calling appShutdown. The emit below is supposed to trigger BitcoinApplication::handleRunawayException:
Line 377 in 59ecacf
which is supposed to show an error dialog and then exit:
Lines 523 to 527 in 59ecacf
If you shut down in BitcoinCore::handleRunawayException, it seems like this is going to delay the dialog from showing up, and maybe even prevent it from being seen by the user. But if this is really an improvement, it would be good to have a comment explaining what the shutdown sequence is.
|
I marked this up for grabs for someone to pick up and address the useful feedback by @ryanofsky |
src/qt/bitcoin.cpp
Outdated
There was a problem hiding this comment.
e here shadows the function parameter in BitcoinCore::handleRunawayException(const std::exception *e).
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
fa9bda1 to
5263d45
Compare
5263d45 to
fd65a6d
Compare
|
Closing, leaving |
The application would either
quitorstd::exiton failure and not even try a shutdown.Note that bitcoind does a
InterruptandShutdownin case the initialization fails or an exception is caught. So just do the same for the gui.