Description
The finding
TestConnectPluginReady_HonorsACallerCancellation (charly/plugin_connect_deadline_test.go:111-135, one of the charly#588 gates) is RED under go test -race and GREEN without it. The test cancels the caller's context at 300 ms and asserts the readiness read aborts within 10 s; under -race the call takes ~32 s — i.e. it returns at the test's own ReadyTimeout: 30 * time.Second, not at the cancel.
It reproduces on origin/main 9fd74793 with an OLD plugin-check pin and on the feat/plugin-check-2128-pin branch with the NEW pin, on a tree whose Go source is byte-identical between them (charly/go.mod + charly/go.sum only). So the pin is not the cause.
RCA
- Mechanism (measured). Under
-race, the caller's cancellation does not abort the in-flight readiness read promptly; the call returns after ~32 s, which tracks the test's 30 sReadyTimeoutrather than the 300 ms cancel. The returned error is a caller-cancellation error, not the readiness-bound error (the test's second assertion, which forbidsdid not become ready within, does not fire — see the logs: only theelapsedassertion fails). Two candidate legs remain un-isolated and are the follow-up's first task: (a) the go-plugin handshake (client.Client(), which takes no context) versus (b) the gRPCDescribeindescribeBounded(plugin_grpc.go:333) ignoring the cancelledrctxunder the race detector. The handshake leg is bounded byloadedReadiness().PerAttempt, whose fallback is 120 s (spec/poll/poll.go:266), so the observed ~32 s is NOT the handshake bound — the wait is in, or the cancel surfaces only at the end of, the readiness leg. - Missed control.
.github/workflows/ci.ymlrunsgo test ./charly/...with no-raceflag, so this class is invisible to the repository's own gate; it was found only by an ad-hoc-racerun during consumer pin work. - Blast radius. The
LocalTransport.Connect(ctx)cancellation contract, and therefore the charly#588 cancellation gate. Production connect sites deliberately passcontext.Background()(plugin_connect_deadline.go:105-112), so no production run hangs today; any future caller that relies on cancelling a connect inherits the ~30 s delay. The non-race suite used by CI is unaffected. - Root fix. Isolate which leg swallows the cancel, then honour the caller's context there (for the handshake: run
client.Client()under a select onctx.Done()and tear down bounded; for the describe leg: makedescribeBoundedreturn on a cancelledrctxrather than at the ReadyTimeout). Then the test must pass under-race.
Evidence (run on a fresh worktree)
Trees: origin/main = 9fd74793, tree be0eb882e33a481f2ed1f660abfdfea2d41439e5; branch head fa0382b5, tree ca520dc07e75460cee69723299c85ebf8706e162 (charly/go.mod +1/−1, charly/go.sum +2/−2).
# origin/main (old pin), -race, the single test
--- FAIL: TestConnectPluginReady_HonorsACallerCancellation (33.94s)
plugin_connect_deadline_test.go:130: cancellation took 33.94319068s to abort the readiness read; the caller's context must propagate
FAIL github.com/opencharly/charly/charly 66.353s
# branch head (new pin), -race, the single test (inside the full package run)
--- FAIL: TestConnectPluginReady_HonorsACallerCancellation (31.84s)
plugin_connect_deadline_test.go:130: cancellation took 31.840173975s to abort the readiness read; the caller's context must propagate
FAIL github.com/opencharly/charly/charly 871.328s
# branch head, same test, NO -race
--- PASS: TestConnectPluginReady_HonorsACallerCancellation (4.46s)
ok github.com/opencharly/charly/charly 8.596s
# branch head, the repo's own configured CI step (no -race)
ok github.com/opencharly/charly/charly 481.711s
ok github.com/opencharly/charly/charly/internal/pluginsgen 131.100s
A first -race run on the branch used GOTMPDIR=$HOME/.cache/go-tmp and produced the same failure (37.09 s) plus a go-plugin socket/handshake warning; re-running with CI's own TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci (/tmp/charly-ci/... paths, well inside the 107-byte sun_path cap) reproduced the failure, so the temp-dir length is a separate, non-causal variable.
Agent: containerd-crabbox-program/charlypin · session 8b1c01cf-7f79-4a75-bff8-240415a06208
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
Activity