Creates psuedo-terminal parent and child FDs (with posix_openpt et al via cgo in os/signal/internal/pty).
Starts a child process which inherits the child end of the PTY.
Starting a new session (Setsid), process group (Setpgid), setting the controlling terminal (Setctty), and setting foreground (Foreground) don't seem to make a difference either way, so the repro skips them.
The child immediately exits (reading from the PTY does not make a difference).
The parent writes a byte to the parent end of the PTY (if nothing is written hang does not occur).
$ ../bin/go test -run=TestDragonfly -v -count=1 os/signal
=== RUN TestDragonfly
signal_cgo_test.go:301: Waiting for exit...
child exiting
<hung>
Specifically, the child exits (CALL exit(0) according to ktrace), but the parent wait6 call never returns. Full ktrace dump is attached here.
This feels like an OS bug, though I attempted to recreate this in C (dragonfly.c in CL 441916) and was not able to reproduce. That said, there are some differences from Go, most notably that both the parent and child are multithreaded in Go.
What version of Go are you using (
go version
)?tip at 6a9aaf1f0218d61aa44c3a0ae0bce03cbac93328
Does this issue reproduce with the latest release?
Yes,
1.19.2
What operating system and processor architecture are you using (
go env
)?dragonfly-amd64
. Specifically, thedragonfly-amd64-622
builder/gomote.go env
OutputWhat did you do?
Run
TestDragonfly
from CL 441916.This test:
posix_openpt
et al via cgo inos/signal/internal/pty
).Setsid
), process group (Setpgid
), setting the controlling terminal (Setctty
), and setting foreground (Foreground
) don't seem to make a difference either way, so the repro skips them.cmd.Wait
.What did you expect to see?
Test passes.
Note that TryBots passed on all other Unix OSes.
What did you see instead?
Test hangs, and eventually times out.
Specifically, the child exits (
CALL exit(0)
according to ktrace), but the parentwait6
call never returns. Full ktrace dump is attached here.This feels like an OS bug, though I attempted to recreate this in C (
dragonfly.c
in CL 441916) and was not able to reproduce. That said, there are some differences from Go, most notably that both the parent and child are multithreaded in Go.cc @golang/dragonfly