You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the Read method on a syscall.RawConn (from *os.File, which is created from *os.NewFile()), I'm getting an error returned: internal/poll.ErrFileClosing from Read()
This is happening when the file gets closed while a read is in progress.
What did you expect to see?
I would not really expect any error here in this case other than io.EOF, perhaps.
What did you see instead?
An error which cannot be handled except from go itself: internal/poll.ErrFileClosing
I'm probably doing something wrong or silly, especially at 5 o'clock on a Friday but in any case it seems like like a bug to get an error from internal/*
The text was updated successfully, but these errors were encountered:
I'm not sure quite what to say except that yes, that is how it works, and that is how it has worked for years, for better or for worse. I'm going to close this as a dup of #4373, but please feel free to comment if you disagree.
This isn't new to using syscall.Conn. You can see the same thing if you Read from a pipe and close the pipe in a different goroutine. The only reason you don't see it with a file is that reading from a file normally doesn't block, but if you are very careful with timing you can see it with a file too.
The whole situation is unfortunate and you can read #4373 to see why. Until that issue is resolved I suggest that you do what most programs do and write strings.Contains(err.Error(), "use of closed file").
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://github.com/containerd/fifo/compare/master...cpuguy83:add_raw_copy?expand=1
Using the
Read
method on asyscall.RawConn
(from*os.File
, which is created from*os.NewFile()
), I'm getting an error returned:internal/poll.ErrFileClosing
fromRead()
This is happening when the file gets closed while a read is in progress.
What did you expect to see?
I would not really expect any error here in this case other than
io.EOF
, perhaps.What did you see instead?
An error which cannot be handled except from go itself:
internal/poll.ErrFileClosing
I'm probably doing something wrong or silly, especially at 5 o'clock on a Friday but in any case it seems like like a bug to get an error from
internal/*
The text was updated successfully, but these errors were encountered: