Skip to content

Conversation

@benthecarman
Copy link
Contributor

@benthecarman benthecarman commented Oct 28, 2025

Previously, the shutdown process could hang when using the bitcoind
backend because the syncing process was not always checking if we had
received the shutdown signal. Now with any future we call during the
sync process we will use a `tokio::select!` to make sure we abort early
if we receive a stop signal.

@benthecarman benthecarman requested a review from tnull October 28, 2025 19:17
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Oct 28, 2025

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the changes to bitcoind behavior here make partially sense to me, as we want to respect the shutdown signal when retrying the initial sync.

However, for the other changes I'm not so sure: a) we generally should attempt for chain syncing to finish gracefully, and picked corresponding timeouts to at least try. b) For Electrum we use a bunch of spawn_blocking internally, which can't be aborted. This means that even though we'd abort polling them, Electrum would still make changes to our LDK objects, which could lead to unexpected behavior if we had already shut down our background processor and hence won't re-persist.

Could you check whether the issue you were seeing would be accounted for by just the changes for the initial bitcoind sync? If not, we'll have to further debug why the timeouts aren't respected.

@benthecarman
Copy link
Contributor Author

Yeah did not need the first commit. Fixed up based on your comments for the second commit.

@benthecarman benthecarman changed the title Fix shutdown hang when background sync operations are in progress Fix bitcoind shutdown hang during initial sync errors and polling Oct 29, 2025
@benthecarman benthecarman requested a review from tnull October 29, 2025 18:55
Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Please rewrite the commit message to better state why this change is necessary and what it does (preferably in 1-2 paragraphs max, nobody will want to read a book of ~inaccurate AI slop in git log).

Previously, the shutdown process could hang when using the bitcoind
backend because the syncing process was not always checking if we had
received the shutdown signal. Now with any future we call during the
sync process we will use a `tokio::select!` to make sure we abort early
if we receive a stop signal.
@benthecarman benthecarman changed the title Fix bitcoind shutdown hang during initial sync errors and polling Fix bitcoind shutdown hang Oct 31, 2025
Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Landing, CI failure should be fixed by #689.

@tnull tnull merged commit 6e33f21 into lightningdevkit:main Oct 31, 2025
0 of 15 checks passed
@benthecarman benthecarman deleted the fix-shutdown branch October 31, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants