Skip to content

Happy Eyeballs cancellation leaves spawned dial attempts running #294

Closed

Description

@dirvine

When an outer timeout or caller cancellation drops happy_eyeballs::race_connect, its pending dial tasks continue running. The race owns a Vec<JoinHandle<()>>, and only the success paths call abort_all; dropping the handles detaches their tasks. The direct-connect path wraps this race in an outer timeout, so returning from that timeout does not cancel the spawned attempts.

Observed in source at commit 4264c345cffe29ad04463fa9c2ee8a2492a38fc2: race ownership and exit paths. This predates and is separate from PR #293.

Expected: every spawned attempt remains owned by the race and is aborted when the race exits or is dropped. Preserve winner selection and all-attempts-failed behavior.

A repair and two inert regression tests are prepared locally. Validation is pending: each test waits until a pending mock dial has entered, cancels or times out the race, then requires its drop witness within a bounded interval. A separate baseline fixture will verify these tests fail on the original implementation. No sockets are needed for this reproduction.

Activity

  1. added a commit that references this issue on Oct 13, 2026
  2. dirvine commented on Oct 18, 2026

    @dirvine
    CollaboratorAuthor

    Closing as fixed after checking current master 133304259e0e679c72ab11d25792c8b1c9ccfbcf (tree e63a0d9eb1c213b4b2a873179eec451be17629b7). PR #326's merge 4c5fde07a2344dd9a30516fa2a7456e7a1651426 is an ancestor of this exact head.

    race_connect now owns all spawned attempts in a JoinSet. Dropping the race drops that set and aborts its attempts. The winner path explicitly aborts the losers and bounds its wait for their completion; the all-attempts-failed path remains covered. The cancellation contract correctly states that Tokio cancellation is cooperative: non-yielding work or a blocking destructor cannot be forcibly stopped.

    Ubuntu library job 117513447502 checked out predecessor b6a74528064f122a1043d8bb50245435efd3ec2a. Current master adds lifecycle-event serialization, its test/changelog and shutdown documentation; happy_eyeballs.rs is byte-identical. Current-master CI is still running. That predecessor job passed dropping_race_cancels_entered_attempt, timing_out_race_cancels_entered_attempt, test_race_cancels_remaining_on_success and test_race_all_fail (2915 tests passed, 0 failed, 8 ignored). The cancellation tests wait for a mock dial to enter, then require its drop witness within a bounded interval after cancellation or timeout. CI Test Suite job 117513847581 independently passed the same controls on that SHA.

    This closes the detached-attempt defect; it does not claim deployment or hard cancellation of non-cooperative code. No local network tests were run for this close-out.

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

      ⌂ 换网址