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

bufio: no way to recover from temporary errors #1934

Closed
gjemiller opened this issue Jun 8, 2011 · 2 comments
Closed

bufio: no way to recover from temporary errors #1934

gjemiller opened this issue Jun 8, 2011 · 2 comments

Comments

@gjemiller
Copy link

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1.  Use bufio to wrap a socket (as a reader)
2.  Call read when there is no data avialable on the socket
3.  Never get data from the socket again


Which compiler are you using (5g, 6g, 8g, gccgo)?
All

Which operating system are you using?
Linux

Which revision are you using?  (hg identify)
bece9e7a644b tip

Please provide any additional information below.
In bufio.Read() ( http://golang.org/src/pkg/bufio/bufio.go?s=3281:3334#L124 ), if the
buffer is empty (b.w == b.r) and a previous read has resulted in an error (b.err != nil)
that it will never again issue a Read to the underlying reader.

This is a problem in the case of "temporary" errors like that issued by a read
to a socket with no data avialable.

Two possible remedies:  provide a bufio.ResetError or test inside the Read method for
the temporariness of the error (which might not be desirable, given that there's no
interface defining the semantics of the Temporary method that occurs on various error
types).
@rsc
Copy link
Contributor

rsc commented Jun 8, 2011

Comment 1:

bufio should just not cache the read error.
same thing happens at EOF.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Jun 27, 2011

Comment 2:

This issue was closed by revision f795bdb.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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