Skip to content

Walk exception cause chain to filter benign signals wrapped by finalizer errors#534

Merged
GoodForOneFare merged 1 commit intomainfrom
gordo-cli-kit-fix-stderr-reraise
Mar 17, 2026
Merged

Walk exception cause chain to filter benign signals wrapped by finalizer errors#534
GoodForOneFare merged 1 commit intomainfrom
gordo-cli-kit-fix-stderr-reraise

Conversation

@GoodForOneFare
Copy link
Copy Markdown
Member

@GoodForOneFare GoodForOneFare commented Mar 17, 2026

When a process receives SIGTERM/SIGHUP/SIGINT, an ensure block (e.g. Dev::Finalize.deliver!) can raise a secondary exception such as Errno::EPIPE or Errno::EBADF when it tries to write to a closed stderr. This secondary exception replaces the original SignalException as the top-level error, but keeps it accessible via Exception#cause.

Previously, exception_for_submission only checked the top-level exception for SignalException, so these wrapped signals fell through to the else branch and were incorrectly reported as bugs.

Add caused_by_benign_signal? which walks the entire cause chain, so SIGTERM/SIGHUP/SIGINT are still filtered even when buried as a cause.

Co-authored-by: Claude noreply@anthropic.com

@GoodForOneFare GoodForOneFare force-pushed the gordo-cli-kit-fix-stderr-reraise branch from e9a48da to 9c6ff9a Compare March 17, 2026 17:54
@GoodForOneFare GoodForOneFare requested a review from a team March 17, 2026 17:54
@GoodForOneFare GoodForOneFare force-pushed the gordo-cli-kit-fix-stderr-reraise branch 7 times, most recently from a94eda4 to 123a62a Compare March 17, 2026 18:14
Copy link
Copy Markdown
Member

@Rylan12 Rylan12 left a comment

Choose a reason for hiding this comment

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

Not entirely sure how to test this since I've not looked at this repo before much, but this makes sense to me

…zer errors

When a process receives SIGTERM/SIGHUP/SIGINT, an ensure block
(e.g. Dev::Finalize.deliver!) can raise a secondary exception such as
Errno::EPIPE or Errno::EBADF when it tries to write to a closed stderr.
This secondary exception replaces the original SignalException as the
top-level error, but keeps it accessible via Exception#cause.

Previously, exception_for_submission only checked the top-level exception
for SignalException, so these wrapped signals fell through to the else
branch and were incorrectly reported as bugs.

Add caused_by_benign_signal? which walks the entire cause chain, so
SIGTERM/SIGHUP/SIGINT are still filtered even when buried as a cause.

Co-authored-by: Claude <noreply@anthropic.com>
@GoodForOneFare GoodForOneFare force-pushed the gordo-cli-kit-fix-stderr-reraise branch from 123a62a to e88ed31 Compare March 17, 2026 20:38
@GoodForOneFare GoodForOneFare merged commit a712ae6 into main Mar 17, 2026
21 checks passed
@GoodForOneFare GoodForOneFare deleted the gordo-cli-kit-fix-stderr-reraise branch March 17, 2026 20:40
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