mcpproxy-go icon indicating copy to clipboard operation
mcpproxy-go copied to clipboard

ci(windows): intermittent fatal fault in internal/security/scanner TPA fetch tests (os.Getenv via testlog after subtest exit)

Open Dumbris opened this issue 1 month ago • 0 comments

What happened

The Build Binaries (windows-latest, windows, amd64) job on PR #1793 (docs-only, head 11b8595c2) crashed the internal/security/scanner test binary with a hard fault, not a test assertion:

=== RUN   TestSolR2_NotModifiedKeepsTheRateLimitBackoff/releases/Retry-After
unexpected fault address 0xffffffffffffffff
fatal error: fault
goroutine 3508 [running]:
runtime.sigpanic()                                  signal_windows.go:398
internal/testlog.Getenv                             internal/testlog/log.go:52
os.Getenv                                           os/env.go:102
internal/config.(...)                               internal/config/config.go:3609
internal/security/scanner.policyFromConfig          internal/security/scanner/tpa_bundle_policy.go:70
internal/security/scanner.fetchTestSettings         internal/security/scanner/tpa_fetch_test.go:116
TestSolR2_NotModifiedKeepsTheRateLimitBackoff.func1 internal/security/scanner/tpa_sol_r2_test.go:24

Run: https://github.com/smart-mcp-proxy/mcpproxy-go/actions/runs/40307733301/job/121521252725

A rerun of the same job on the same SHA passed, and the three PRs merged just before (#1717, #1745, #1746) passed the Windows job, so it is intermittent.

Why it matters

The fault is inside os.Getenv → internal/testlog.Getenv, called from config.go:3609 (an env read in the config accessors) during a parallel subtest of the TPA fetch tests. A fault at 0xffffffffffffffff in the testing log hook on Windows usually means the subtest kept running after its parent test returned (a goroutine or t.Parallel leak), so the test log was already torn down. If that is the cause it is a test-hygiene bug in tpa_sol_r2_test.go / tpa_fetch_test.go (fetch goroutines or timers outliving the test), not production code, but it will keep failing Windows builds at random.

Suggested check

  • Run go test -race -count=20 -run 'TestSolR2|TestDeltaFetch' ./internal/security/scanner/ on Windows and Linux and look for goroutines that outlive their test (goleak, or a t.Cleanup that waits for the refresh loop to stop).
  • fetchTestSettings and the refresh/fetch helpers should stop every goroutine and timer in t.Cleanup before the subtest returns.

Dumbris avatar Oct 26 '26 11:10 Dumbris