fix: prevent silent RecurringTask death and swallowed timeouts in AutoscaledPool#2009
Draft
vdusek wants to merge 1 commit into
Draft
fix: prevent silent RecurringTask death and swallowed timeouts in AutoscaledPool#2009vdusek wants to merge 1 commit into
vdusek wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2009 +/- ##
==========================================
+ Coverage 93.35% 93.36% +0.01%
==========================================
Files 179 179
Lines 12482 12486 +4
==========================================
+ Hits 11652 11658 +6
+ Misses 830 828 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
RecurringTaskdies silently.RecurringTaskran its function bare in the loop, so the first exception permanently killed the underlying asyncio task. Nothing awaited the task untilstop()(which suppresses exceptions), so state persistence, autoscaling snapshots, statistics logging, and browser cleanup could die silently mid-run.AutoscaledPoolswallows timeouts.AutoscaledPool._worker_taskcaught everyasyncio.TimeoutErrorand logged "Task timed out after not set seconds". Since_TASK_TIMEOUTis never set,wait_for(timeout=None)can't time out itself, so the only timeouts it ever caught were real errors escaping the task function (e.g. session fetch or mark-as-handled timeouts). Swallowing them left the request stuck in progress andrun()hung forever.Changes
RecurringTask. The wrapper now logs the exception and keeps the recurrence going.AutoscaledPool. The pool now re-raises when no task timeout is configured, so such errors propagate and stop the pool, matching how all other exceptions already behave.Tests
Both fixes are covered by regression tests that failed before the change.