Skip to content

os/exec: TestStdinCloseRace fails #18286

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

Closed
alexbrainman opened this issue Dec 12, 2016 · 2 comments
Closed

os/exec: TestStdinCloseRace fails #18286

alexbrainman opened this issue Dec 12, 2016 · 2 comments
Milestone

Comments

@alexbrainman
Copy link
Member

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version devel +cbcc1db Sun Dec 11 21:59:59 2016 +0000 windows/amd64

What operating system and processor architecture are you using (go env)?

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=c:\dev
set GORACE=
set GOROOT=C:\dev\go
set GOTOOLDIR=C:\dev\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\brainman\AppData\Local\Temp\go-build999495023=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

What did you do?

go test -short os/exec

What did you expect to see?

test pass

What did you see instead?

--- FAIL: TestStdinCloseRace (0.02s)
exec_test.go:271: Wait: succeeded unexpectedly
FAIL
exit status 1
FAIL os/exec 2.645s

This only happens occasionally. But easy enough to reproduce. I do not understand why Wait should not succeed, so suggestions on how to debug this are welcome. Thank you.

Alex

@ianlancetaylor
Copy link
Contributor

The test TestStdinCloseRace starts a child process that reads from standard input. It starts one goroutine that kills the child process, and one goroutine that writes a string to the child's standard input. In the normal case, the process should be killed, so Wait should return a non-zero exit status.

That said, the test does seem to itself have a race condition, in that it is possible for the the string to be written to the child's standard input and for the child to exit normally before the other goroutine kills the child. And it appears that I was the one who added the racy test. Will send a fix.

@ianlancetaylor ianlancetaylor added this to the Go1.8 milestone Dec 13, 2016
@ianlancetaylor ianlancetaylor self-assigned this Dec 13, 2016
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/34287 mentions this issue.

@golang golang locked and limited conversation to collaborators Dec 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants