Skip to content
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

io: endless loop in MultiReader in Go 1.7 #16795

Closed
bradfitz opened this issue Aug 19, 2016 · 5 comments
Closed

io: endless loop in MultiReader in Go 1.7 #16795

bradfitz opened this issue Aug 19, 2016 · 5 comments

Comments

@bradfitz
Copy link
Contributor

https://golang.org/cl/17873 (git rev ccdca83, bug #13558) was added in Go 1.7 and introduced a bug where the EOF of a (non-zero, EOF) Read could be ignored and the MultiReader could loop, forever yielding bytes.

Just hit this myself.

@bradfitz bradfitz added this to the Go1.7.1 milestone Aug 19, 2016
@bradfitz bradfitz self-assigned this Aug 19, 2016
@bradfitz
Copy link
Contributor Author

Sent https://golang.org/cl/27397

@gopherbot
Copy link

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

@ianlancetaylor
Copy link
Contributor

The CL says that this bug has been present since Go 1.0, so this is not a 1.7.1 issue.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.8, Go1.7.1 Aug 22, 2016
@bradfitz
Copy link
Contributor Author

@ianlancetaylor, I think this is bad enough and in a core piece of io to warrant a fix, regardless of how many cycles it's been broken.

Like I said, this bit me in real code and I had to go on a debugging spree to figure out what was going on.

What would people who weren't comfortable debugging the standard library do?

@ianlancetaylor
Copy link
Contributor

Hmmm, well, OK, I guess.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.7.1, Go1.8 Aug 22, 2016
gopherbot pushed a commit that referenced this issue Aug 22, 2016
Updates #16795

Change-Id: I0bcc34bb5a92a2c480aebfb0eb6ba57bcc7f7cfd
Reviewed-on: https://go-review.googlesource.com/27551
Reviewed-by: Ian Lance Taylor <iant@golang.org>
gopherbot pushed a commit that referenced this issue Sep 7, 2016
If an io.Reader returned (non-zero, EOF), MultiReader would yield
bytes forever.

This bug has existed before Go 1 (!!), introduced in the original
MultiReader implementation in https://golang.org/cl/1764043 and also
survived basically the only update to this code since then
(https://golang.org/cl/17873, git rev ccdca83), which was added in
Go 1.7.

This just bit me when writing a test for some unrelated code.

Fixes #16795

Change-Id: I36e6a701269793935d19a47ac12f67b07179fbff
Reviewed-on: https://go-review.googlesource.com/27397
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-on: https://go-review.googlesource.com/28633
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@golang golang locked and limited conversation to collaborators Aug 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