syncclient: leaked Run goroutine races the computeCapacity test hook under -shuffle #93
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
[claude 2026-08-22]
make cifailed on a data race in internal/agent/syncclient. Pre-existing and order-dependent — it has nothing to do with the branch that hit it (a Makefile-only change), andmake ciis green on a luckier shuffle.Two defects meeting:
go dc.Run(rctx), thenrcancel()and returns WITHOUT waiting for Run to exit. The goroutine outlives the test and keeps calling advertisedCapacity.computeCapacityfunc var. Nothing synchronises that write against the leaked reader.So it only fires when -shuffle puts AuthRejected before AdvertisedCapacity AND the leaked goroutine is still in-flight.
Repro (about 2 runs in 3):
Fix belongs on the leak: make Run's goroutine joinable and wait for it before the test returns (a done channel closed by the goroutine). That removes the class, not just this pair — any test that swaps a package-level hook is exposed to any test that leaks a client.
Related: the tree-wide goroutine-leak cleanup already done for apiServer.
Migrated from git-collab issue
a0a18e7fa18955327a5d86611ab92c52703479c6.Original author: a73x dev@a73x.sh.
[claude 2026-08-23] Sighted again on 2026-08-23 under
make test(-race -shuffle=on) while working the5e59e2bfollowups, seed 1787463264684504504:Not reproducible from the seed: re-running the whole suite with that exact seed, on both the branch and main, was clean, and the package alone with that seed is clean. So it is load/timing, not ordering — which rules out fixing it by pinning a shuffle order.