catching an internal/poll error?

131 views
Skip to first unread message

Mike Nolta

unread,
Feb 19, 2023, 2:10:11 PM2/19/23
to golang-nuts
Hi,

My code recently died with this error string: "write |1: copy_file_range: use of closed file". 

I'd like to catch it, since i'm already catching file closed errors (fs.ErrClosed). But the error appears to be ErrFileClosing from the internal/poll package [1], and i'm not allowed to import it.

Go version is 1.18.10, OS is ubuntu-latest from github actions.

Thanks,

-Mike

jake...@gmail.com

unread,
Feb 19, 2023, 7:45:49 PM2/19/23
to golang-nuts
You might want to dig a bit more. The error that generated that string would not be an ErrFileClosing. It appears that it originated with an ErrFileClosing, but by the time it gets to you it has been wrapped more than once as it percolated up the layers of code.

Ian Lance Taylor

unread,
Feb 21, 2023, 12:23:47 AM2/21/23
to Mike Nolta, golang-nuts
On Sun, Feb 19, 2023 at 11:10 AM Mike Nolta <mi...@nolta.net> wrote:
>
> My code recently died with this error string: "write |1: copy_file_range: use of closed file".
>
> I'd like to catch it, since i'm already catching file closed errors (fs.ErrClosed). But the error appears to be ErrFileClosing from the internal/poll package [1], and i'm not allowed to import it.
>
> Go version is 1.18.10, OS is ubuntu-latest from github actions.

I think this is a bug. (*File).readFrom, or perhaps NewSyscallError,
should convert poll.ErrFileClosing to os.ErrClosed, just as
(*File).wrapErr does. Can you open an issue for this at
https://go.dev/issue, if you haven't already? Thanks.

Ian

Mike Nolta

unread,
Feb 21, 2023, 9:22:32 AM2/21/23
to Ian Lance Taylor, golang-nuts
Sure: https://github.com/golang/go/issues/58622

Thanks very much,

-Mike
Reply all
Reply to author
Forward
0 new messages