Hi everyone! I met this issue, some months ago, with Node 0.8.x. I think the same issue could be at 0.10.x
I have two opened sockets: socketin, socketout. With something like: socketin.on('data', /* process input data, transform it, and maybe, write to socketout */); socketout.on('error', /* remove socketout or mark it as unusable */); socketout.on('close', /* remove socketout or mark it as unusable */); But, then, I encountered something like: 1- The main JavaScript is buse 2- Internal IO enqueue socketin.on new data 3- Internal IO enqueue socketout.on error (remote client disconnect) 4- The callback for socketin.on new data gains control 5- It calls socketout.write(newdata), then exception The problem is that the callback for socketout error or close event was not processed yet. In some scenerarios, in my personal projects, there is an array of input sockets, and an array of output sockets, with logic that transform data and decides to whichs output sockets write the new transformed data. But the issue is the same: sometimes, I got an exception, because my code write data to an already closed socket. I solved the problem with if (socketout.writable) socketout.write(newdata) else .... No more unhandled exceptions, so far. But I have questions: - Is my description of the root cause right? - Is my solution THE solution to apply? My solution depends on something I didn't know: someone, at socket implementation, implemented the immediate switch of .writable to false, when the socket is closed or it has an error. Then, another question: - Is that "feature" a socket implementation one? Or is it usually implemented on every writable stream? Angel "Java" Lopez @ajlopez -- -- 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 --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.