Skip to content

Exit reliably on backend disconnect - #128

Merged
Sjors merged 3 commits into
stratum-mining:masterfrom
Sjors:2026/09/backend-disconnect-exit-status
Sep 30, 2026
Merged

Sjors merged 3 commits into
stratum-mining:masterfrom
Sjors:2026/09/backend-disconnect-exit-status

Conversation

@Sjors

@Sjors Sjors commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Report backend disconnects as failures so systemd restarts sv2-tp, with a five-second delay. Requested shutdown still exits successfully.

Temporarily remove the PID file and exit before IPC cleanup to avoid the race addressed by libmultiprocess #361. Extend the mining scenario to verify backend loss while the SRI pool remains connected.

Preserve graceful cleanup while returning EXIT_FAILURE when the mining
backend disconnects, so supervisors can restart a fresh process.
Requested shutdown continues to return EXIT_SUCCESS.

Add a five-second delay to the systemd restart policy and update the
integration scenario to assert the failure status and PID-file cleanup.
@Sjors Sjors changed the title sv2-tp: report backend disconnect as a failure Report backend disconnect as a failure Sep 30, 2026
Register a backend disconnect handler before libmultiprocess's cleanup
handler. Remove the PID file and call _Exit(EXIT_FAILURE) so IPC thread
teardown cannot race with connection cleanup.

The context hook and inline connection setup are temporary parts of the
workaround for libmultiprocess PR #361, and can be removed together once
its fix is imported. Requested shutdown still uses normal cleanup and
returns success.
Continue the mining scenario into the backend disconnect checks while
its SRI pool is still connected. Previously the scenario returned after
mining, leaving backend disconnect behavior with an active pool
unchecked.

Require failure exit status, the disconnect log, and PID-file removal
before reporting success.
@Sjors Sjors changed the title Report backend disconnect as a failure Exit reliably on backend disconnect Sep 30, 2026
@Sjors
Sjors merged commit 6137771 into stratum-mining:master Sep 30, 2026
25 checks passed
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