Skip to content

Harden exponential backoff: clamp visibility >= 0, don't mask origina…#1030

Draft
mensfeld wants to merge 1 commit into
mainfrom
fix/b11-backoff-visibility-guard
Draft

Harden exponential backoff: clamp visibility >= 0, don't mask origina…#1030
mensfeld wants to merge 1 commit into
mainfrom
fix/b11-backoff-visibility-guard

Conversation

@mensfeld

Copy link
Copy Markdown
Collaborator

…l error

Two defensive fixes in the exponential backoff retry middleware:

  1. next_visibility_timeout could return a negative value when a job ran longer than the 12h SQS ceiling (max_timeout goes below zero), and change_message_visibility rejects a negative timeout. Clamp to 0.

  2. handle_failure called change_visibility unguarded. If rescheduling raised (e.g. an expired receipt handle), that exception propagated out of the rescue in #call and masked the original worker error, hiding the real failure from exception handlers/notifiers. Rescue it, log, and report 'not retried' so the original error is re-raised and the message falls back to the queue's default visibility timeout.

…l error

Two defensive fixes in the exponential backoff retry middleware:

1. next_visibility_timeout could return a negative value when a job ran
   longer than the 12h SQS ceiling (max_timeout goes below zero), and
   change_message_visibility rejects a negative timeout. Clamp to 0.

2. handle_failure called change_visibility unguarded. If rescheduling
   raised (e.g. an expired receipt handle), that exception propagated out
   of the rescue in #call and *masked the original worker error*, hiding
   the real failure from exception handlers/notifiers. Rescue it, log, and
   report 'not retried' so the original error is re-raised and the message
   falls back to the queue's default visibility timeout.
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ea762d7-614e-45b3-b89c-1f10a5e8e612

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/b11-backoff-visibility-guard

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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