-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: using go test, goroutine stack dump sometimes not emitted on SIGQUIT #27189
Comments
If I use |
I don't fully understand what's going on here, but it seems related to the call to go/src/cmd/go/internal/test/test.go Line 1161 in 67ac554
which seems to swallow SIGQUIT: go/src/cmd/go/internal/base/signal.go Lines 13 to 31 in db3f52d
|
go test disables sigquit for itself so you don't get two sets of
tracebacks; the parent (go test) and the child (the process that go test
forked)
…On 4 September 2018 at 10:03, Mark Rushakoff ***@***.***> wrote:
I don't fully understand what's going on here, but it seems related to the
call to base.StartSigHandlers in cmd/go/internal/test/test.go:
https://github.com/golang/go/blob/67ac554d7978eb93f3dfe7a819c679
48dd291d88/src/cmd/go/internal/test/test.go#L1161
which seems to swallow SIGQUIT:
https://github.com/golang/go/blob/db3f52db8edfa51c76d1e3e1a417d4
6b85528132/src/cmd/go/internal/base/signal.go#L13-L31
https://github.com/golang/go/blob/db3f52db8edfa51c76d1e3e1a417d4
6b85528132/src/cmd/go/internal/base/signal_unix.go#L14
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#27189 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA3IMUWNl-SD5YZ1Ldah367YntBEfks5uXcNGgaJpZM4WKjm3>
.
|
Possibly related to #24929? |
I played around with this a little more last night. My current repro case is a little simpler than the top post. Here's my test file: package a_test
import (
"testing"
"time"
)
func TestSleep(t *testing.T) {
time.Sleep(20 * time.Second)
} And then in bash I run this one-liner rather than manually sending SIGQUIT: With either
And other times it just silently quits:
There doesn't seem to be any obvious reason why it sometimes prints a stack trace and sometimes doesn't. For a test that has minimal dependencies, The silent failure is particularly annoying when running a test suite that normally finishes quickly, seeing 10 seconds later that unexpectedly it hasn't finished and CPUs are idle, and then manually sending SIGQUIT only to have it silently exit without dumping the stack. |
When you press |
What version of Go are you using (
go version
)?Tried
go version go1.10.3 darwin/amd64
,go version go1.11rc1 darwin/amd64
, andgo version devel +6e76aeba0b Thu Aug 23 20:27:47 2018 +0000 darwin/amd64
.What did you do?
I had a test that appeared to be stuck in a blocking operation, and I pressed
^\
to send SIGQUIT, but I didn't receive any output. Then when I ran the test again usinggo test -v
, sending SIGQUIT produced the goroutine stacks I expected to see.Here's a sample test I'm using in the following output:
Running just
go test .
doesn't produce output on SIGQUIT, but I do see output withgo test -v .
.If I change the file to include a test that calls t.Log, then I seem to be able to get a stack dump with tip, but not with 1.10 or 1.11rc1:
If I comment out the t.Logf call, but keep
TestPass
, then gotip no longer produces a stack dump on SIGQUIT.The text was updated successfully, but these errors were encountered: