Skip to content

[v3.7.0] fix: pre-existing race-flake in cmd/sin-code/internal (4min timeout) #56

@Delqhi

Description

@Delqhi

Bug

go test -race -count=1 -timeout 240s ./cmd/sin-code/internal/ times out
(4 min) under -race. One of the 240-second-package-tests hangs and never
finishes. Suspect: HTTP server test that doesn't shut down its listener
(via httptest.NewServer without t.Cleanup), or subprocess re-exec that
never gets killed.

Reproduce

go test -race -count=1 -timeout 60s -v ./cmd/sin-code/internal/ 2>&1 | tail -50

Last lines before the hang typically show the test name and a goroutine
blocked on a channel read or HTTP accept.

Expected

All tests in the package complete in <10s under -race.

Actual

Test runner hits the 60s / 240s timeout without ever returning.

Fix

  • Find the hanging test via verbose run
  • Add srv.Close() via t.Cleanup for httptest servers
  • Add cmd.Process.Kill() via t.Cleanup for subprocess exec
  • Convert defer to t.Cleanup so it fires on panic too
  • Verify: go test -race -count=3 -timeout 90s ./cmd/sin-code/internal/ — all 3 runs green

Cross-refs

  • Related: PR fix(v3.6.0-internal-race-hang) (in progress)
  • AGENTS.md §3 mandate M7 (race-free concurrency)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions