rules_itest icon indicating copy to clipboard operation
rules_itest copied to clipboard

Stack dumps not produced from timed out go-tests

Open azdagron opened this issue 11 months ago • 1 comments

When a service_test wrapping a go_test times out, it kills the go test indirectly via a context cancellation on CommandContext, inhibiting the go test from dumping useful stack traces to stderr.

It would be really nice to have those stack traces available.

Off the cuff solutions:

  1. Override the TEST_TIMEOUT envvar set by bazel by some reduced margin so that the go test hits its own natural timeout and exits with stack traces
  2. kill the go test process via SIGQUIT (e.g. override the Cancel func on the exec.Command to send a different signal), which also produces stack traces

(1) would work with any test written for bazel test (i.e. those that honor TEST_TIMEOUT)

azdagron avatar Jan 08 '25 20:01 azdagron

@azdagron Hi, apologies for losing track of this one. I like your first proposal; since we know how long it took the services to startup, we can quite accurately reset the wrapped test's TEST_TIMEOUT. I'll give that a shot tomorrow!

zbarsky-openai avatar Apr 03 '25 04:04 zbarsky-openai

Fixed in 0c8aad1d969db3d5e8b26dd4989dc51419b0d53f, thanks!

dzbarsky avatar Jun 19 '25 14:06 dzbarsky