Skip to content

Fit failed execution errors into size-limited error columns - #822

Merged
rosa merged 1 commit into
rails:mainfrom
bhawsartanmay:fix-oversized-failed-execution-error
Nov 2, 2026
Merged

rosa merged 1 commit into
rails:mainfrom
bhawsartanmay:fix-oversized-failed-execution-error

Conversation

@bhawsartanmay

Copy link
Copy Markdown
Contributor

On MySQL, error is a TEXT column limited to 65,535 bytes. Only the backtrace was truncated to make room, and the budget was computed from the raw message size plus a fixed overhead. A message that didn't fit by itself, or that grew past the limit once JSON-escaped, made saving the failed execution raise ActiveRecord::ValueTooLong. The worker then stopped with a FinalizationError and released the job back to ready, so it ran and failed again on the next worker, over and over.

Measure the error as it'll be stored, through the attribute's own type, drop backtrace lines first and, if that's not enough, truncate the message. Errors without a backtrace no longer crash the truncation.

Fixes #821

On MySQL, `error` is a TEXT column limited to 65,535 bytes. Only the
backtrace was truncated to make room, and the budget was computed from
the raw message size plus a fixed overhead. A message that didn't fit
by itself, or that grew past the limit once JSON-escaped, made saving
the failed execution raise ActiveRecord::ValueTooLong. The worker then
stopped with a FinalizationError and released the job back to ready,
so it ran and failed again on the next worker, over and over.

Measure the error as it'll be stored, through the attribute's own type,
drop backtrace lines first and, if that's not enough, truncate the
message. Errors without a backtrace no longer crash the truncation.

Fixes rails#821
@bhawsartanmay

Copy link
Copy Markdown
Contributor Author

The two failing MySQL jobs failed in "Initialize containers" (failed to set up container networking) before any tests ran, and the six cancelled Ruby 3.2 jobs hit the 15-minute timeout, same as on the other recent PR runs. Everything else passes.

@rosa rosa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you, great catch and fix. Sorry for the delay!

@rosa
rosa merged commit c202f0a into rails:main Nov 2, 2026
50 of 58 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.

Failed jobs with large error messages crash workers and get re-run forever on MySQL

2 participants