-
Notifications
You must be signed in to change notification settings - Fork 7.3k
EPIPE with the repl and cat? #3027
Comments
This also dates back to at least node |
Seems to work fine for me.
Just pulled from master again, to make sure it wasn't a recent bug.
Have you tried seeing if the |
Can reproduce on Mac OS X. Works without problems on Linux. |
@Southern There does not appear to be a "SIGPIPE" event that happens. |
Ok this does indeed seem to be an OS X problem. I tried it on Solaris, Windows, and Linux and it worked as expected in all those places. I didn't try my REPL over curl example on all those platforms, but I think that is a different problem now. @mmalecki @Southern Can you guys try out the REPL over curl example as well? Requires node v0.7.7. |
Not sure that my testing it would be of any help, since I am using Linux. |
@Southern I have a feeling that the "repl-over-curl" situation is a little different. I was able to reproduce a similar crash in Interestingly Windows was ok, though the color codes do not get interpreted properly since curl doesn't know how to handle them. |
Is #3211 a simple test case of the same thing? (edit: perhaps not - |
Have reproduced this on Ubuntu 12.04 too when too much content get written to repls and lot of connections. https://gist.github.com/3906440: test files that almost always give Error: write EPIPE
at errnoException (net.js:769:11)
at Object.afterWrite (net.js:593:19) Node 0.8.12 -> % uname -ra
Linux [...] 3.2.0-32-generic [...] Ubuntu [...] x86_64 x86_64 x86_64 GNU/Linux Maybe this is just an inode problem? dunno |
I'm going to close this because it's not really a node bug. When you run
tl;dr It's a bug in cat, it should switch to polling mode when it sees EAGAIN but it doesn't. It may be possible to work around that by reopening /dev/tty in node but I'm a) not sure that'll work at all, and b) that it'll work on all supported Unices. |
@bnoordhuis I appreciate the explanation and it makes perfect sense to me. I'm confused, though, at why only OS X seems to exhibit this behavior, and the other OSs seem alright. |
It happens on Linux as well but the tty output buffer is a lot bigger there, on the order of 256 kB. On OS X, it's around 4 kB (or 8 or 16 kB - a lot smaller anyway) so it fills up faster. |
I learn so much from you Ben :) On Tue, Dec 4, 2012 at 6:35 PM, Ben Noordhuis notifications@github.comwrote:
|
Basically, I'm seeing EPIPE errors when a "large" amount of data gets printed to the output stream when using the repl over pipes. To reproduce, inspect a largish object in the repl, like
process
or evenprocess.env
. This is on OS X, happens on both Terminal and iTerm2.So that's bad. I've also seen
cat
print to the screen:cat: write error: Resource temporarily unavailable
. Interestingly, if we turnstdin
into a pipe as well, then it seems to work overcat
(the-i
flag on node makes it enter the repl, rather than interpret stdin as a piped-in JS file):So this is a little strange to me. Naively, it seems like something possibly on our (libuv?) end, but I really don't know the fine details here.
Another interesting tidbit is that I get essentially the same behavior when running a repl over an HTTP server, connecting using
curl
. It works seemingly ok, but if you print outprocess.env
for example, thencurl
crashes with:curl: (23) Failed writing body (0 != 2020)
. See this gist: https://gist.github.com/2053342The text was updated successfully, but these errors were encountered: