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

cursor Bot commented May 24, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes are limited to process lifecycle, logging, and shutdown paths; no proving logic, RPC semantics, or auth/data handling are modified.

Overview
Adds operational hardening for the transaction prover binary: panics and container shutdowns show up as structured logs instead of ad-hoc stderr output.

A new install_panic_hook runs after tracing is initialized and emits a single event=panic error! with message, source location, and backtrace (abort behavior unchanged). tracing-subscriber gains the json feature to support existing JSON log format.

SIGTERM and SIGINT are wired to ServerHandle::stop with shutdown_started / shutdown_complete log events so orchestrator teardown is visible and in-flight work can drain. Handler install failures are warned but partial handlers still run. A second termination signal triggers force_exit and exit(1) so a stuck graceful shutdown cannot trap the process (Tokio signal quirk). tokio adds the signal feature for Unix signal streams.

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

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@cursor cursor Bot 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.

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
@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
@avi-starkware avi-starkware force-pushed the avi/prover-v3/content-id branch from 4055121 to bfa94e0 Compare May 31, 2026 10:23
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch 2 times, most recently from 8d4c874 to bdf34cf Compare June 1, 2026 08:17
@avi-starkware avi-starkware force-pushed the avi/prover-v3/content-id branch 2 times, most recently from 54145f3 to adf3407 Compare June 1, 2026 11:18
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-shutdown branch from bdf34cf to 15340a8 Compare June 1, 2026 11:18
…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/panic-shutdown branch from 15340a8 to d7e132f Compare June 7, 2026 10:11
@avi-starkware avi-starkware force-pushed the avi/prover-v3/content-id branch from adf3407 to a6853d8 Compare June 7, 2026 10:11
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