fix: apply the configured timeout and retries to API v1 uploads - #514
Open
gibiw wants to merge 1 commit into
Open
fix: apply the configured timeout and retries to API v1 uploads#514gibiw wants to merge 1 commit into
gibiw wants to merge 1 commit into
Conversation
The configured testops.api.timeout reached result uploads but never the API v1 client, so an attachment request that stalled without failing was waited on forever. The batch it belonged to was never submitted, the reporter thread never finished, and pytest -- one pytest-xdist worker in particular -- could only be killed by the CI timeout. No exception was raised, so the retry wrapper never saw anything to retry. Every API v1 call now carries the configured timeout, and attachment batches are retried with the same policy as result uploads. When the attempts are exhausted the reporter logs the failure, drops those attachments and still submits the results they belong to. Refs #513
gibiw
force-pushed
the
fix/513-attachment-upload-timeout
branch
from
September 8, 2026 15:16
21d1123 to
b3b204d
Compare
nismangulov
approved these changes
Sep 9, 2026
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.
Related to #513 — deliberately not auto-closing it. The issue stays open until the fix is released, then gets a comment asking the reporter to try the released version.
Problem
testops.api.timeoutwas passed to API v2 result submission but never to the API v1 client. An attachment upload that stalled — connection open, no response, no exception — was therefore waited on indefinitely: the result batch being prepared was never submitted, the reporter thread stayed alive, andcomplete_run()'swhile self.count_running_threads > 0loop kept the pytest process (onepytest-xdistworker) running until CI killed it.Because no exception was raised,
send_with_retry()never had anything to retry. And attachment errors that did raise were swallowed inside_upload_attachment()'s per-batchexcept, so the outer retry never saw those either.Changes
_request_timeout=self.config.testops.api.timeout— attachment uploads plusget_project,get_environments,get_configurations,create_configuration_group,create_configuration,get_run,complete_run,create_run,update_run_publicityandrun_update_external_issue. All of them ran without a timeout; the ones on the main thread would hang the session just as effectively.send_with_retry()withtestops.api.retries/testops.api.retryBackoff, the same policy as result uploads: transport failures and 408/429/5xx retried, 4xx not.~=5.1.x, so no reporter version bump is needed.Acceptance criteria from the issue
QASE_TESTOPS_API_TIMEOUTapplied to v1 attachment uploadsReadTimeoutError, whichis_retryable()treats as retryableretriestotal attempts per batchI deliberately did not add a bounded wait to
complete_run()/complete_worker(). The unbounded request was the root cause; capping the wait would trade a hang for silent result loss and needs its own design.Tests
New
tests/tests_qase_commons/test_api_v1_client.py(13 tests): timeout propagation for each v1 call, retry of a retryable attachment failure, stopping after the configured attempts, not retrying a 4xx, and a failed batch not aborting the batches after it.tox -e py312: 304 passed in qase-python-commons, 123 passed in qase-pytest.