Skip to content

TestUDPSocketLoopback can hang, and only the 40-minute suite timeout stops it #895

Open

Description

@tannevaled

TestUDPSocketLoopback can hang, and nothing stops it before the 40-minute suite timeout

What happened

go test ./internal/vm/ on 2026-11-05, on a branch whose only change adds a
deprecation warning to ObjectSpace._id2ref:

panic: test timed out after 40m0s
    running tests:
        TestUDPSocketLoopback (38m19s)
FAIL  github.com/go-embedded-ruby/ruby/internal/vm  2401.819s

No --- FAIL line anywhere: nothing asserted wrong. The suite ran out of
wall-clock with one test blocked for 38 minutes.

The same suite, same machine, same day, passed three times on other branches at
218s, 221s and 228s. So this is not the suite being slow; it is one test
not returning.

Why it costs more than one run

  • The failure arrives as FAIL <package> 2401s with a goroutine dump. Read
    quickly, that looks like a broken change — the first instinct is to blame the
    diff, and the diff here could not have caused it.
  • 40 minutes of a CI runner is spent before anything is reported.
  • -timeout is the suite's, not the test's, so the first test to hang decides
    how long everything takes and every later test is simply never run. A hang in
    a networking test silently cancels the rest of the package.

What would close it

A deadline inside the test, not around the suite:

  • dial/read with an explicit SetDeadline, so a lost datagram fails the test
    in seconds with a message that names the socket;
  • and a t.Context()/timer guard, so the test fails rather than blocks if the
    deadline itself is never reached.

Worth a sweep for siblings rather than a point fix: any test that blocks on a
socket, a pipe or a channel with no deadline has the same shape, and the suite
timeout is not a substitute — it reports the symptom 40 minutes later and
attributes it to whatever branch happened to be building.

Not established

Why the datagram was lost. The machine was at a 1-minute load average of ~7.7
with ~25 concurrent sessions, which is a plausible story and only a story — it
has not been reproduced, and this issue is about the test having no deadline,
which is true either way.

🤖 Generated with Claude Code

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