Skip to content

Name the cause of a failed request, and fix 3 CI tests that fail on slower machines - #71

Open
Parakh20 wants to merge 1 commit into
prooflinedev:mainfrom
Parakh20:fix/transport-error-cause
Open

Parakh20 wants to merge 1 commit into
prooflinedev:mainfrom
Parakh20:fix/transport-error-cause

Conversation

@Parakh20

Copy link
Copy Markdown

Problem

  1. A request that fails to send reports only reqwest's top line, e.g. could not reach http://...: error sending request for url (...). A refused connection, a timeout and a bad certificate all read the same, so a CI log never says why.
  2. On my machine (Linux, cargo 1.100) three tests fail on a clean main: a_refused_request_is_asked_once_and_the_wait_runs_to_the_deadline, a_review_still_running_at_the_deadline_is_unavailable and only_a_pull_request_job_on_its_own_identity_asks_once_after_two_minutes. They use a paused clock with real loopback sockets. The clock jumps ahead while the runtime waits on a socket, passes the client's 10 s connect timeout, and the OIDC token request fails with tcp connect error: deadline has elapsed.

Change

  • Http::transport now appends each error cause: ...: client error (Connect): tcp connect error: Connection refused (os error 111). A new unit test binds and drops a port, then asserts the reason names the refusal. It fails without the change.
  • Tests only: a cfg(test) Http::without_deadlines for the paused-clock tests. One assertion pinned the request to within 1 s of 2 min; it now checks 2 min <= at < 3 min (the job deadline), since the drift depends on the machine.

Checks

cargo test (3 runs), cargo fmt --check, cargo clippy --all-targets: all clean.

Notes for the reviewer

  • Cause text can differ by OS; the test only checks for "refused".
  • Production timeouts and retry behavior are unchanged.
  • Open question: is the relaxed 2-3 min window acceptable, or do you prefer another way to stop the paused clock racing sockets?

…acing real sockets

A request that failed to send reported only reqwest's top line, such as
"error sending request for url (...)", so a refused connection, a timeout
and a certificate error all read the same. Transport errors now append each
cause: "...: client error (Connect): tcp connect error: Connection refused".

Three CI tests ran on a paused clock against real loopback sockets. The
clock jumps ahead whenever the runtime waits on a socket, so on a slower
machine it passed the client's 10 s connect timeout and the job's OIDC token
request failed. They now use a client without deadlines, and one assertion
no longer pins a request to within a second of two minutes.

This branch has not been deployed

No deployments
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.

1 participant