Skip to content

net: DialContext can use a stale context via happy eyeballs #21600

Open
@tombergan

Description

@tombergan

When happy eyeballs is enabled, DialContext makes parallel calls to dialSingle via dialParallel:

func dialParallel(ctx context.Context, dp *dialParam, primaries, fallbacks addrList) (Conn, error) {

Each dialSingle call may call ctx.Value, such as here:

trace, _ := ctx.Value(nettrace.TraceKey{}).(*nettrace.Trace)

dialParallel doesn't wait for all dialSingle calls to complete. This means, in theory, dialSingle can call ctx.Value on a ctx that has gone out of scope. This is effectively the same problem as #21597.

/cc @bcmills

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions