It seems leaving the process.nextTick is fine, as long as it emits an error/close after the callbacks are registered if the error event was in fact missed between ticks, which seems like something easy to check for and a good interim fix if there is some larger architectural fix planned later. I'll probably be patching this up in our node fork and can send a pull request if desired.
Thanks for the information. On Tuesday, September 4, 2012 11:28:48 AM UTC-7, Ben Noordhuis wrote: > > On Tue, Sep 4, 2012 at 7:49 PM, Jimb Esser <wast...@gmail.com<javascript:>> > wrote: > > In http.js in the node source, ClientRequest.prototype.onSocket uses > > process.nextTick before setting up the error and close handlers, but it > > seems that a socket can be closed before that callback and the error > > handlers will never be called. Is this a bug? Is there something I'm > > missing that would make this code somehow safe? > > > > Why I ask is that under high load, we've had some HTTP requests end up > never > > completing, never getting an error, and the OS reports having no open > > sockets. I added an on('socket') event that asserted that the socket > we're > > handed was not already disconnected, and this has started firing, which > > means we're being handed a disconnected socket (and any error or > disconnect > > events we set immediately upon creating the request will never get > called. > > This is in the context of a large application with a lot of other stuff > > going on, so it's possible we have a bug elsewhere, but tracing up the > > callstack when we get passed a disconnected socket makes me think this > code > > in http.js that may be at fault. > > It's a know bug, there are several bug reports about it. It'll be > addressed eventually but the problem is that the nextTick is there for > a reason, removing it introduces other issues. > -- 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 nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en