Repository navigation
fix(serve): raise PollingTimeoutError instead of hanging in AsyncPredictor - #6412
Open
AkshayShah03 wants to merge 1 commit into
Open
AkshayShah03 wants to merge 1 commit into
AkshayShah03 wants to merge 1 commit into
Conversation
…ictor _check_output_and_failure_paths waited in a loop until either the output or the failure file was found. When both S3 waiters gave up (WaiterError after max_attempts * delay), neither event was set and the loop spun forever, so predict()/the wait on an async endpoint never returned, and the PollingTimeoutError branch was unreachable. That branch also fetched the failure object before checking whether it existed. Exit the loop once both waiter threads have finished, raise AsyncInferenceModelError only when the failure file was found, and PollingTimeoutError otherwise. v2 handles this case (aws#4951); unlike v2, this keeps waiting for the failure waiter if only the output waiter has timed out, so a model error that lands slightly later is still reported as such.
AkshayShah03
had a problem deploying
to
manual-approval
October 9, 2026 23:59 — with
GitHub Actions
Failure
AkshayShah03
had a problem deploying
to
manual-approval
October 9, 2026 23:59 — with
GitHub Actions
Failure
AkshayShah03
had a problem deploying
to
manual-approval
October 9, 2026 23:59 — with
GitHub Actions
Failure
This branch had an error being deployed
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.
Issue #, if available: N/A
Description of changes:
AsyncPredictor._check_output_and_failure_pathsruns two S3object_existswaiters, one for the output file and one for the failure file, then loops until either one is found:If both waiters give up, raising
WaiterErroraftermax_attempts * delay, neither event is set. The loop then spins forever, sopredict()on an async endpoint never returns and thePollingTimeoutErrorbranch is unreachable. That branch also calledget_objecton the failure key before checking that the file existed.This change:
AsyncInferenceModelErroronly when the failure file was found, andPollingTimeoutErrorotherwise.v2 fixed the hang in #4951 with a "waiter error" event. That version stops as soon as either waiter fails, so a failure file that appears just after the output waiter times out gets reported as a timeout. Waiting on thread liveness avoids that.
Testing:
test_raises_polling_timeout_when_both_waiters_time_out: hangs before this change. The test runs the call in a daemon thread with a join timeout, so a hang fails the test instead of the suite.test_raises_model_error_when_failure_file_appears_after_output_waiter_times_out.tests/unit/test_predictor_async.py: 18 passed.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.