Skip to content

sv2-tp: handle signals while connecting to the node - #165

Draft
xyephy wants to merge 1 commit into
stratum-mining:masterfrom
xyephy:2026/11/early-signal-handlers
Draft

xyephy wants to merge 1 commit into
stratum-mining:masterfrom
xyephy:2026/11/early-signal-handlers

Conversation

@xyephy

@xyephy xyephy commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

sv2-tp registered its SIGTERM and SIGINT handlers only after connecting to the node, so the g_interrupt checks in the retry loop never fired. Stopping sv2-tp while it waited for the node killed it, and the PID file was left behind.

This registers the handlers before connecting. While connectAddress() or makeMining() is blocking, the handler falls back to the default action, so a node that doesn't answer still can't delay shutdown, same as before.

Not addressed here: once connected, a SIGTERM still waits for the node if it stops answering, because isInitialBlockDownload() blocks. That was already the case on master.

The SIGTERM and SIGINT handlers were registered after the IPC connect
loop, so a signal during the retry wait killed the process and left the
PID file behind. Register them first. While an IPC call is blocking,
fall back to the default action, so a stuck node can't delay shutdown.
@xyephy
xyephy marked this pull request as draft November 12, 2026 09:36
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.

1 participant