Skip to content

io: Pipes not returning first error produced #35642

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
frankywahl opened this issue Nov 17, 2019 · 1 comment
Closed

io: Pipes not returning first error produced #35642

frankywahl opened this issue Nov 17, 2019 · 1 comment

Comments

@frankywahl
Copy link

I noticed pipes do not keep their errors after being closed. This had already been filed here and said to be fixed here but it seems like the problem still remains.

The test outlined in https://play.golang.org/p/0dHxDLpZGTB (also as a Gist show the failure mode - happening on both darwin and linux at the moment.

This makes relying on the error produced unreliable, and can lead to subtle bugs due to the non-deterministic nature of the error value returned.

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

go version go1.13.4 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

Worked on docker golang:latest - ImageID: 54e71dcafb7c

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build660770461=/tmp/go-build -gno-record-gcc-switches"

What did you do?

See: https://play.golang.org/p/0dHxDLpZGTB or Gist

What did you expect to see?

CustomError

What did you see instead?

EOF

@josharian josharian changed the title Pipes not returning first error produced io: Pipes not returning first error produced Nov 17, 2019
@toothrot
Copy link
Contributor

Thanks for reporting this and adding the helpful samples.

I think the sleeps / goroutines in the linked playground are a red herring. I've updated your playground with a more simple example: https://play.golang.org/p/vdx89KY3hFr

I think the fix you mentioned is not a part of Go 1.13, but looks like it made the cut for 1.14. The test I linked passes successfully for me on master. I do not believe the issue would pass the bar for backporting.

I'll close this for now, but please feel free to comment if I am mistaken.

@golang golang locked and limited conversation to collaborators Nov 17, 2020
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