This repository has been archived by the owner on May 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 654
uv__read() blocks sometimes when reading from a pipe #941
Comments
It seems that an easy workaround is to stick a uv__nonblock call into uv_open_pipe. I'm not sure whether it is a proper solution or not though. |
bnoordhuis
added a commit
to nodejs/node-v0.x-archive
that referenced
this issue
Sep 28, 2013
uv_pipe_open() is unlikely to fail but when it does, the failure should not be quietly ignored. Raise the error as an exception. See joyent/libuv#941.
Thanks for the bug report, good catch. Fixed in 8fe4ca6. |
@bnoordhuis should the fix also be applied to uv_tcp/udp_open ? |
I'll update those as well. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
uv__read() immediately retries a read when a preceding read fills the entire buffer. This presents a problem when a stream being read is a pipe (for example a redirected standard input). If a process on the write end of the pipe writes exactly 64k of data to the pipe, then uv__read() will issue a second read immediately on an empty pipe, and it will block. Here is a reproduction in Node.JS:
If we feed a small amount of data to the script, it works as expected, calling the interval callback every second:
If however we feed 64k of data, the callback is not called:
Here is an strace output from a normal run:
Here is an strace output from a blocked process:
GDB stack trace:
The text was updated successfully, but these errors were encountered: