Skip to content

S3 transaction race#1119

Draft
Georgehe4 wants to merge 1 commit into
mainfrom
cursor/s3-transaction-race-6a10
Draft

S3 transaction race#1119
Georgehe4 wants to merge 1 commit into
mainfrom
cursor/s3-transaction-race-6a10

Conversation

@Georgehe4
Copy link
Copy Markdown
Contributor

Add client-side resilience to handle a backend race condition where S3 data might not be immediately available after a successful job status.

The backend writes S3 data within a database transaction. This can lead to a race condition where the database transaction commits a SUCCESS status before the corresponding S3 data is fully written and available. Clients fetching the job result immediately after the SUCCESS status might encounter 500 errors (due to missing S3 files) or receive a SUCCESS status with None data. This client-side fix introduces retries with exponential backoff specifically for this scenario, allowing time for S3 eventual consistency, and also increases general retry parameters for transient 500 errors.


Slack Thread

Open in Cursor Open in Web

Address the S3 race condition (LI-5775) where the backend DB may commit
a SUCCESS status before the S3 data write fully propagates, causing
transient 500 errors or null data when fetching extraction runs.

Changes:
- Add _get_run_with_data_check() wrapper in _wait_for_job_result that
  detects SUCCESS runs with null data and retries with exponential
  backoff (2s, 4s, 8s) to allow S3 writes to propagate
- Increase run_retry_attempts from 3 to 5 and run_max_wait from 4/20
  to 30 for more resilient handling of transient 500 errors from
  the backend's S3 read failures
- Add warning messages when the race condition pattern is detected
  to aid debugging

Co-authored-by: George He <georgewho96@gmail.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Feb 17, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 17, 2026

⚠️ No Changeset found

Latest commit: a87743d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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