[nodejs] http "connection reset by peer" hook

1,662 views
Skip to first unread message

bd3287db2938d32

unread,
May 6, 2010, 5:07:01 AM5/6/10
to nodejs
how to handle the message "connection reset by peer" in node HTTP
server ? if i got this message, server just going down and node
process killing :(

--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.

Serge in Darkness

unread,
May 6, 2010, 6:13:06 AM5/6/10
to nodejs
I have this one too. Node.js version 0.1.93, using Express from kiwi.

On May 6, 1:07 pm, bd3287db2938d32 <chelovekpaukspaset...@gmail.com>
wrote:

cumhur onat

unread,
May 6, 2010, 6:16:14 AM5/6/10
to nodejs
You can use something like this right after the connection listener of
http:

request.socket.removeAllListeners('error');
request.socket.addListener('error',function(er){
//put here something to delete the connection like :
request.socket.destroy();
});

On 6 Mayıs, 12:07, bd3287db2938d32 <chelovekpaukspaset...@gmail.com>
wrote:

bd3287db2938d32

unread,
May 6, 2010, 8:00:47 AM5/6/10
to nodejs
no effect :(

------------------------

function httpServerHandler(req, res){
try{

var parsed = url.parse(req.url);
var path = parsed.pathname;

req.socket.removeAllListeners('error');
req.socket.addListener('error',function(er){
sys.puts(er);
req.socket.destroy();
throw (er);
});
SKIPPEDSKIPPEDSKIPPEDSKIPPEDSKIPPEDSKIPPED
}
var server = http.createServer(httpServerHandler);
server.listen(http_port);
--------------------------------------

i just hold CTRL+R in browser and server crash

bd3287db2938d32

unread,
May 6, 2010, 8:01:50 AM5/6/10
to nodejs
and NO output
"sys.puts(er); " not work and no console ouput

Matt Ranney

unread,
May 6, 2010, 10:56:08 AM5/6/10
to nod...@googlegroups.com
On Thu, May 6, 2010 at 5:01 AM, bd3287db2938d32 <chelovekpa...@gmail.com> wrote:
and NO output
"sys.puts(er); " not work and no console ouput

Can you try with HEAD?  I think this commit may have fixed this issue:

 

bd3287db2938d32

unread,
May 6, 2010, 11:05:17 AM5/6/10
to nodejs
process.addListener('SIGPIPE', function () {

solve problem, thx
Reply all
Reply to author
Forward
0 new messages