-
Notifications
You must be signed in to change notification settings - Fork 266
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
wasi: add nonblock_test.go from gotip, fix nonblock read on Unix-like #1517
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
ew, I guess this is a bad case of WorksOnMyMachine™️ |
weird, on Linux it does set nonblock = true, but it still blocks on read?? we can go straight to the syscall; in that case, EAGAIN is returned correctly and the runtime jumps through all the FDs, but apparently all of them have always no data and return EAGAIN. I guess I am going to debug this later/tomorrow. EDIT2: well sure they had nothing to read, I was redirecting the pipe to screen instead :D so the syscall approach does work... let's see what I can do... EDIT3: so that's why I had to setNonblock(fd) every time I called
|
OK I think I found a solution that is more solid; pretty much, again, like for sockets, going almost straight to the syscall layers for platforms that we support for nonblocking I/O (i.e. Unix for now). Probably better to add some specific test case before finalizing this, but this should make the gotip test work everywhere. |
ok apparently something I did (maybe the |
Windows is fixed, but it looks like everything else is still broken... I'll investigate tomorrow, unless someone else wants to take over :) |
Thanks for the focused help on this stuff @evacchi! |
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
added tiny test case for |
the timeouts are back, let's try to revert the commit with the build flags and see if it's related |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
…tetratelabs#1517) Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Adapt and add the test from Go's WASI test suite nonblock.go for non-blocking I/O (pipes) to our own suite. Go (almost) straight to the syscall layer for
read()
on supported platforms; i.e., this is currently Unix-only. This also adds the fieldfd
to the structosFile
because apparentlyf.file.Fd()
resets theO_NONBLOCK
flag on the fd /o.Signed-off-by: Edoardo Vacchi evacchi@users.noreply.github.com