On Tue, Aug 7, 2012 at 6:05 AM, Felix Halim <[email protected]> wrote: > On Tue, Aug 7, 2012 at 3:47 AM, Ben Noordhuis <[email protected]> wrote: >> No, libuv (and node.js) handles that fine. Chances are high that the >> bug is in your application. > > After further investigation, valgrind says that it got a SIGPIPE: > > ==17980== Process terminating with default action of signal 13 (SIGPIPE) > ==17980== at 0x4E380D0: __write_nocancel (syscall-template.S:82) > ==17980== by 0x40AC30: uv__write (stream.c:430) > ==17980== by 0x40B9BA: uv__stream_io (stream.c:752) > ==17980== by 0x4063D2: uv__io_rw (core.c:655) > ==17980== by 0x41B533: ev_invoke_pending (ev.c:2145) > ==17980== by 0x405A45: uv__poll (core.c:248) > ==17980== by 0x405A8F: uv__run (core.c:257) > ==17980== by 0x405AED: uv_run (core.c:265) > ==17980== by 0x405040: main (webserver.c:174) > > > So my guess is that my program get signalled when the client > prematurely terminates the connection? > So, I should handle SIGPIPE error in my application?
Yes, that's correct. Sorry, didn't realize Ryan's example didn't handle SIGPIPE. A `signal(SIGPIPE, SIG_IGN)` is sufficient, libuv takes care of the rest. I have some half-baked plans to use `sendmsg(MSG_NOSIGNAL)` instead of `write()` but that's only a partial solution - Linux and FreeBSD support it, Solaris and OS X don't. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
