S3 transaction race#1119
Draft
Georgehe4 wants to merge 1 commit into
Draft
Conversation
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 Agent can help with this pull request. Just |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
SUCCESSstatus before the corresponding S3 data is fully written and available. Clients fetching the job result immediately after theSUCCESSstatus might encounter 500 errors (due to missing S3 files) or receive aSUCCESSstatus withNonedata. 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