Skip to content

Fix: SIGTERM/SIGINT during a mempool-update borks signal handling requiring SIGKILL to kill process. - #165

Merged
mononaut merged 4 commits into
mempoolfrom
junderw/fix-sigterm-sigint
Oct 24, 2026
Merged

mononaut merged 4 commits into
mempoolfrom
junderw/fix-sigterm-sigint

Conversation

@junderw

@junderw junderw commented Oct 15, 2026

Copy link
Copy Markdown
Member

Fixes #164

Fix from @ZenulAbidin cherry-picked from ZenulAbidin/electrs@84f464d~2...84f464d

Includes a rust-analyzer / rustup fix that makes IDE usage with rust-analyzer much easier.

junderw and others added 3 commits October 15, 2026 22:20
A SIGINT/SIGTERM is delivered through the Waiter channel only once. If the
wait() that receives it belongs to a caller that logs and swallows errors
(e.g. Mempool::update in the main loop while retrying a bitcoind
reconnect), the signal is lost: the main loop never stops and the process
keeps running until it is SIGKILLed.

Store the received termination signal in the Waiter (shared by clones) so
that every later wait() fails with ErrorKind::Interrupt immediately.
@junderw
junderw requested review from mononaut and a balanced review from Copilot October 15, 2026 13:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

CI setup still requires the deleted toolchain file and fails before checks run.

1 open finding
What changed in this PR

Addresses #164 by preserving shutdown signals across waiter clones, so a logged mempool-update error cannot discard the shutdown request.

Changes:

  • Adds persistent interrupt state and regression tests.
  • Corrects the interrupt error message.
  • Migrates toolchain configuration to TOML with IDE components.
File Description
src/​signal.rs Preserves termination signals and tests subsequent waits.
src/​errors.rs Fixes a typo in the interrupt message.
rust-toolchain.toml Pins Rust 1.87 and requests development components.
rust-toolchain Removes the legacy toolchain file.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rust-toolchain.toml

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

Static review found no blocking issues in the shutdown fix, regression tests, or updated CI toolchain handling.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@mononaut mononaut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested ACK @ [f3c8713]

@mononaut
mononaut merged commit 160585b into mempool Oct 24, 2026
14 checks passed
@mononaut
mononaut deleted the junderw/fix-sigterm-sigint branch October 24, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] SIGTERM/SIGINT during a mempool-update RPC reconnect logs a warning but electrs keeps running indefinitely

5 participants