-
Notifications
You must be signed in to change notification settings - Fork 38.7k
init: Return EXIT_SUCCESS on interrupt #34224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34224. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
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. |
|
Concept ACK 3dbbac0 |
dergoegge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 3dbbac0
|
I don't think this works. At least locally, I am still seeing diff --git a/src/init.cpp b/src/init.cpp
index f2af858eb4..b6e903c497 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1828,2 +1828,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
+ std::cout << "a\n";
+ UninterruptibleSleep(1s);
+ std::cout << "b\n";
+
// As LoadBlockIndex can take several minutes, it's possible the userSo it now works fine when pressing |
An interrupt does not create a failure exit code during normal operation. This should also be the case when interrupt is triggered during initialization. However a failure exit code is currently returned if an interrupt occurs during init. Fix this by making `AppInitMain` return true instead of false, which further up the call stack sets the `EXIT_FAILURE` code. Also add a check for the interrupt condition during GUI startup.
3dbbac0 to
997e7b4
Compare
|
Updated 3dbbac0 -> 997e7b4 (init_interrupt_zero_0 -> init_interrupt_zero_1, compare) |
|
review ACK 997e7b4 🔺 Show signatureSignature: |
janb84
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 997e7b4
PR fixes exit code on SIGINT while being in init.
While I was first under the impression that the exit code should be 130 (as per Advanced Bash-Scripting Guide:) because of SIGINT, this is not the case. SIGINT is correctly handled by the application ending in a clean shutdown so it should be 0 (which is the case after this PR)
e.g. killing a bitcoin node with SIGKILL results in a 137
Details
2026-01-08T20:26:49Z dnsseed thread exit
Killed: 9 ./bitcoind --regtest
[nix-shell:~/Projects/bitcoin/build_dev_mode/bin]$ echo $?
137
dergoegge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 997e7b4
|
rfm? |
Reported by dergoegge on irc.
An interrupt does not create a failure exit code during normal operation. This should also be the case when interrupt is triggered during initialization. However a failure exit code is currently returned if an interrupt occurs during init. Fix this by making
AppInitMainreturn true instead of false on interrupt, which further up the call stack currently sets theEXIT_FAILUREcode. Also add a check for the interrupt condition during GUI startup. ReturningEXIT_SUCCESSseems to be the usual behaviour for daemons, see the discussion on IRC for this: https://www.erisian.com.au/bitcoin-core-dev/log-2026-01-08.html#l-146 .Best reviewed with
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space.