Skip to content

starknet_transaction_prover: global panic hook + graceful SIGTERM shutdown#14166

Open
avi-starkware wants to merge 1 commit into
avi/prover-v3/content-idfrom
avi/prover-v3/panic-shutdown
Open

starknet_transaction_prover: global panic hook + graceful SIGTERM shutdown#14166
avi-starkware wants to merge 1 commit into
avi/prover-v3/content-idfrom
avi/prover-v3/panic-shutdown

Conversation

@avi-starkware
Copy link
Copy Markdown
Collaborator

Installs a process-wide panic hook that emits one structured event=panic
tracing event with location and backtrace, and bridges SIGTERM/SIGINT into
ServerHandle::stop so container teardown becomes visible in logs and
in-flight proofs get to finish. A second signal forces exit(1) to work
around tokio-rs/tokio#7905.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

@cursor
Copy link
Copy Markdown

cursor Bot commented May 24, 2026

PR Summary

Low Risk
Changes are limited to process lifecycle, logging, and shutdown paths; no proving, RPC business logic, or auth changes.

Overview
Improves operability of the transaction prover binary: panics and container shutdown now show up as structured logs instead of ad-hoc stderr behavior.

A new server/panic module installs a process-wide panic hook (after tracing init) that logs event=panic with message, source location, and a forced backtrace, while keeping default abort-on-panic semantics. extract_payload is covered by a serial unit test.

main wires SIGTERM and SIGINT into jsonrpsee’s ServerHandle::stop, logs shutdown_started / shutdown_complete, and on a second signal logs force_exit and exits with code 1 so operators can escape a stuck graceful shutdown (workaround for Tokio signal behavior). Handler registration is best-effort if one signal type fails to install.

Cargo.toml enables tokio’s signal feature and tracing-subscriber’s json feature so JSON log format and Unix signal handling compile.

Reviewed by Cursor Bugbot for commit 073a1ff. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Collaborator Author

avi-starkware commented May 24, 2026

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c31ce65. Configure here.

return s.clone();
}
"<non-string panic payload>".to_string()
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reimplements already-stable standard library method

Low Severity

The extract_payload function manually reimplements PanicHookInfo::payload_as_str(), which was stabilized in Rust 1.91.0. The project's rust-toolchain.toml specifies channel 1.95, so the standard library method is already available. The doc comment on extract_payload references a nightly-2025-07-14 toolchain that no longer matches the project's actual pinned toolchain, making the stated reason for the workaround stale.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c31ce65. Configure here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Actually, the crate starknet_transaction_prover uses the referenced nightly toolchain, so the doc comment is not stale

@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch from c31ce65 to 72a08b0 Compare May 26, 2026 12:16
@avi-starkware avi-starkware force-pushed the avi/prover-v3/request-logs branch 2 times, most recently from 2dcb716 to f83f30c Compare May 26, 2026 12:17
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch from 72a08b0 to 17dbfd9 Compare May 26, 2026 12:17
@avi-starkware avi-starkware force-pushed the avi/prover-v3/request-logs branch from f83f30c to 53b6a1e Compare May 26, 2026 12:58
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch from 17dbfd9 to 9845d29 Compare May 26, 2026 12:58
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch from 9845d29 to 4d23115 Compare May 26, 2026 16:14
@avi-starkware avi-starkware force-pushed the avi/prover-v3/request-logs branch from 53b6a1e to 4645e9b Compare May 26, 2026 16:14
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch from 4d23115 to c3950e4 Compare May 26, 2026 16:59
@avi-starkware avi-starkware force-pushed the avi/prover-v3/request-logs branch from 4645e9b to 278ffaa Compare May 26, 2026 16:59
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch from c3950e4 to fe2dccc Compare May 27, 2026 10:01
@avi-starkware avi-starkware force-pushed the avi/prover-v3/request-logs branch 2 times, most recently from 6a64324 to e28dee6 Compare May 27, 2026 10:35
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch 2 times, most recently from 5d57ce5 to d99ffe1 Compare May 27, 2026 12:55
@avi-starkware avi-starkware force-pushed the avi/prover-v3/request-logs branch 2 times, most recently from 91c2bfc to b232a8e Compare May 27, 2026 13:11
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch from d99ffe1 to 264bf5b Compare May 27, 2026 13:11
@avi-starkware avi-starkware changed the base branch from avi/prover-v3/request-logs to graphite-base/14166 May 27, 2026 14:03
@avi-starkware avi-starkware force-pushed the graphite-base/14166 branch from b232a8e to fb6037b Compare May 27, 2026 14:03
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch from 264bf5b to 282284b Compare May 27, 2026 14:04
@avi-starkware avi-starkware changed the base branch from graphite-base/14166 to avi/prover-v3/content-id May 27, 2026 14:04
…tdown

Installs a process-wide panic hook that emits one structured `event=panic`
tracing event with location and backtrace, and bridges SIGTERM/SIGINT into
`ServerHandle::stop` so container teardown becomes visible in logs and
in-flight proofs get to finish. A second signal forces `exit(1)` to work
around tokio-rs/tokio#7905.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avi-starkware avi-starkware force-pushed the avi/prover-v3/content-id branch from fb6037b to 4055121 Compare May 27, 2026 14:20
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch from 282284b to 073a1ff Compare May 27, 2026 14:20
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.

2 participants