Skip to content

fix(worker, shared): Handle urllib3 ReadTimeoutError during report chunk retrieval#854

Open
sentry[bot] wants to merge 1 commit intomainfrom
seer/fix/report-read-timeout
Open

fix(worker, shared): Handle urllib3 ReadTimeoutError during report chunk retrieval#854
sentry[bot] wants to merge 1 commit intomainfrom
seer/fix/report-read-timeout

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry Bot commented Apr 18, 2026

Fixes WORKER-Y8M. The issue was that: ReportService.get_existing_report_for_commit fails to catch ReadTimeoutError during GCS chunk retrieval, crashing UploadFinisher.

  • Added urllib3.exceptions import to apps/worker/services/report/__init__.py.
  • Implemented urllib3.exceptions.ReadTimeoutError handling in apps/worker/services/report/__init__.py to log a warning and return None when a timeout occurs while reading report chunks.
  • Added urllib3.exceptions import to libs/shared/shared/reports/api_report_service.py.
  • Implemented urllib3.exceptions.ReadTimeoutError handling in libs/shared/shared/reports/api_report_service.py to log a warning and return None when a timeout occurs while reading report chunks.

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

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

Low Risk
Low risk: adds defensive handling for storage read timeouts, changing behavior from crashing to logging and returning None (which may skip report-based processing on transient failures).

Overview
Prevents worker/shared report-building code from crashing when chunk retrieval from storage times out.

Both ReportService.get_existing_report_for_commit (worker) and build_report_from_commit (shared) now catch urllib3.exceptions.ReadTimeoutError, log a warning with commit/repo context, and return None to allow downstream flows (e.g., upload finishing/comparisons) to continue gracefully.

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

Comment on lines +346 to 348
)
return None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Bug: The exception handler for urllib3.exceptions.ReadTimeoutError is incomplete. Due to the Minio client's retry configuration, a urllib3.exceptions.MaxRetryError will be raised, which is not caught.
Severity: HIGH

Suggested Fix

Update the except block to also catch urllib3.exceptions.MaxRetryError. This will ensure that read timeouts are handled correctly even after all retries from the Minio client's urllib3 configuration are exhausted.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: apps/worker/services/report/__init__.py#L346-L348

Potential issue: The Minio client is configured with `Retry(total=5)`. When a
`ReadTimeoutError` occurs while reading data chunks, `urllib3` retries the operation. If
all retries fail, `urllib3` raises a `MaxRetryError` wrapping the original
`ReadTimeoutError`. The new `try...except` block only catches
`urllib3.exceptions.ReadTimeoutError`, not `urllib3.exceptions.MaxRetryError`. This will
result in an unhandled exception, causing the worker to crash, which is the exact issue
the change was intended to prevent.

Did we get this right? 👍 / 👎 to inform future reviews.

@sentry
Copy link
Copy Markdown
Contributor Author

sentry Bot commented Apr 18, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.24%. Comparing base (0ad8a0c) to head (cf82439).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
libs/shared/shared/reports/api_report_service.py 0.00% 4 Missing ⚠️
apps/worker/services/report/__init__.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #854      +/-   ##
==========================================
- Coverage   92.25%   92.24%   -0.02%     
==========================================
  Files        1307     1307              
  Lines       48017    48025       +8     
  Branches     1636     1636              
==========================================
+ Hits        44299    44301       +2     
- Misses       3407     3413       +6     
  Partials      311      311              
Flag Coverage Δ
apiunit 96.35% <ø> (ø)
sharedintegration 36.88% <0.00%> (-0.02%) ⬇️
sharedunit 84.88% <0.00%> (-0.03%) ⬇️
workerintegration 58.53% <25.00%> (-0.01%) ⬇️
workerunit 90.38% <50.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link
Copy Markdown

codecov-notifications Bot commented Apr 18, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
libs/shared/shared/reports/api_report_service.py 0.00% 4 Missing ⚠️
apps/worker/services/report/__init__.py 50.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 18, 2026

Merging this PR will not alter performance

✅ 9 untouched benchmarks


Comparing seer/fix/report-read-timeout (cf82439) with main (0ad8a0c)

Open in CodSpeed

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