Skip to content

io: PipeWriter.Close causes deadlock since weekly.2012-03-27 #18401

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
navytux opened this issue Dec 21, 2016 · 1 comment
Closed

io: PipeWriter.Close causes deadlock since weekly.2012-03-27 #18401

navytux opened this issue Dec 21, 2016 · 1 comment
Milestone

Comments

@navytux
Copy link
Contributor

navytux commented Dec 21, 2016

Hello up there. net.Pipe does not adhere to net.Conn interface because net.Pipe.Close does not unblock net.Pipe.Write (and it must according to net.Conn.Close description).

What did you do?

Demo program: https://play.golang.org/p/pKLqjwHRoJ

What did you expect to see?

Program prints "woken up"

What did you see instead?

Program deadlocks:

fatal error: all goroutines are asleep - deadlock!

goroutine 1 [semacquire]:
sync.runtime_notifyListWait(0x1044044c, 0x1)
	/usr/local/go/src/runtime/sema.go:267 +0x1e0
sync.(*Cond).Wait(0x10440444, 0x1377e0)
	/usr/local/go/src/sync/cond.go:57 +0xe0
io.(*pipe).write(0x10440400, 0x1040e1c8, 0x4, 0x8, 0x0, 0x180050, 0x1040a088, 0x8)
	/usr/local/go/src/io/pipe.go:89 +0x300
io.(*PipeWriter).Write(0x1040a188, 0x1040e1c8, 0x4, 0x8, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/io/pipe.go:156 +0x60
main.main()
	/tmp/sandbox843618967/main.go:20 +0x3a0

Does this issue reproduce with the latest release (go1.7.4)?

yes

System details

go version devel +8599c0da1f Wed Dec 21 05:37:31 2016 +0000 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/kirr/go"
GORACE=""
GOROOT="/home/kirr/src/tools/go/go"
GOTOOLDIR="/home/kirr/src/tools/go/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build742777661=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
GOROOT/bin/go version: go version devel +8599c0da1f Wed Dec 21 05:37:31 2016 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +8599c0da1f Wed Dec 21 05:37:31 2016 +0000 X:framepointer
uname -sr: Linux 4.8.0-2-amd64
Distributor ID:	Debian
Description:	Debian GNU/Linux testing (stretch)
Release:	testing
Codename:	stretch
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Debian GLIBC 2.24-8) stable release version 2.24, by Roland McGrath et al.
gdb --version: GNU gdb (Debian 7.12-4) 7.12
@gopherbot
Copy link
Contributor

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

@mikioh mikioh changed the title net.Pipe: Write+Close deadlock io: PipeWriter.Close causes deadlock since weekly.2012-03-27 Dec 21, 2016
@mikioh mikioh added this to the Go1.8 milestone Dec 21, 2016
@golang golang locked and limited conversation to collaborators Dec 22, 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