Skip to content

fix(worker): Robustify bundle analysis error handling with explicit upload_id and session rollbacks#804

Open
sentry[bot] wants to merge 1 commit intomainfrom
seer/fix/bundle-analysis-error-handling
Open

fix(worker): Robustify bundle analysis error handling with explicit upload_id and session rollbacks#804
sentry[bot] wants to merge 1 commit intomainfrom
seer/fix/bundle-analysis-error-handling

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry bot commented Apr 14, 2026

Fixes WORKER-Y79. The issue was that: Concurrent cleanup deleted the Upload record, causing StaleDataError during update, leading to PendingRollbackError on subsequent lazy-load.

  • Capture upload_id as a plain integer early in the bundle analysis processing to ensure its availability for logging.
  • Pass upload_id explicitly to the _set_upload_error_and_commit function for more reliable error logging.
  • Add db_session.rollback() calls within exception handlers to reset the SQLAlchemy session state, preventing issues like 'session is DEACTIVE' when attempting to log or update upload status after a database error (e.g., StaleDataError).
  • Improve the overall robustness of bundle analysis error handling.

This fix was generated by Seer in Sentry, triggered automatically. 👁️ Run ID: 13291765

Not quite right? Click here to continue debugging with Seer.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.


Note

Medium Risk
Touches bundle analysis upload processing and error paths, including transaction rollbacks and upload state updates; mistakes here could change retry/error behavior or leave uploads in incorrect states.

Overview
Improves bundle analysis processor resilience when the Upload row disappears mid-processing (e.g., cleanup causing StaleDataError). It now captures a stable upload_id early for logging, explicitly rolls back the SQLAlchemy session before logging/fallback updates after commit/update failures, and threads upload_id into _set_upload_error_and_commit so error logs don’t depend on potentially-deactivated ORM objects.

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

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.

0 participants