Skip to content

Windows: oauth loopback tests flake on ConnectionReset (10054) RST-on-close race #509

Description

@emal-avala

Symptom

Test (windows-latest) intermittently fails with panics in:

  • services::oauth::tests::loopback_rejects_callback_missing_state_with_code (crates/lib/src/services/oauth.rs:1244)
  • services::oauth::tests::loopback_rejects_state_mismatch_hard (crates/lib/src/services/oauth.rs:1214)

on ConnectionReset (os error 10054). Observed twice on the v0.28.0 release branch (#496) on a head whose only change was CHANGELOG.md, and the identical code passed on the previous head — provably environmental. A --failed rerun passed.

Cause

Windows sends RST when a socket with unread data is closed; the loopback test server's close races the client's read, so the client sees 10054 instead of the expected HTTP rejection response.

Suggested fix

Make the loopback test client (or the reject path in the server) tolerate ConnectionReset after the response has been written — e.g. read the response before dropping, shutdown(Write) then drain, or retry-once on 10054 in the test helper. Keep the assertion on the rejection semantics; only the transport race should be tolerated.

Acceptance

  • The two tests never fail with 10054 across repeated Windows CI runs
  • No weakening of the state-mismatch / missing-state rejection assertions

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions