-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
os: reading from tun device after using command pipe: read /dev/net/tun: not pollable
#38618
Comments
read /dev/net/tun: not pollable
read /dev/net/tun: not pollable
Hi @andybons, I've also tried the SysConn variant
It works even worse. It completely blocks the |
I can get the problem to occur when running the program without an argument, although it fails much more often with the argument |
An strace shows
In other words, we can successfully register the descriptor with |
@mandelsoft Could you see if https://golang.org/cl/229764 fixes the problem for you? Thanks. |
Change https://golang.org/cl/229764 mentions this issue: |
Please see #30426. The tun fd is put into The But it returns With CL 229764, it will always work if the fd is in blocking mode. |
Hi @crvv, thank you very much, using Maybe someone should bring this fix to the pkg/taptun project. That's the first search result when using google to look for |
@mandelsoft @crvv Do you think it would be a good idea to apply CL 229764, or should we just treat this as a Linux kernel bug that can be worked around in Go code by using |
I'm not so deep into this OS topic to decide on this. I just found this taptun library and tried to used it. |
OK, thanks. Closing this issue as there is a workaround. |
Avoid "tun not pollable": golang/go#38618
What version of Go are you using (
go version
)?Does not appear with 1.12
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?
I'm creating a tun device and trying to read from it.
Read
aborts with the errorread /dev/net/tun: not pollable
, if before creating the tun device (file descriptor) anexec.Command
is executed, but only if this catches the output.Calling the program below with argument
no
works.If argument
yes
is given, the problem occurs in most of the cases, but not always.If the output is not catched (remove c.Stdout` assignment in code below) it also works if the
command is executed before the interface creation.
What did you expect to see?
I expect the read to work and the program should print the size of the packet send to the tun device.
What did you see instead?
Instead the read failed with the error
read /dev/net/tun: not pollable
The text was updated successfully, but these errors were encountered: