NodeJS socket problem FIN_WAIT1 FIN_WAIT2 CLOSE_WAIT

We were facing some problems with NodeJs when handling sockets and file descriptors.

Fortunately we applied this patch and the problem is gone

/* Copyright (c) 2013 Wang Wenlin. See LICENSE for more information */
;(function () {
var TCP = process.binding('tcp_wrap').TCP
, _setKeepAlive = TCP.prototype.setKeepAlive
, _shutdown = TCP.prototype.shutdown;
TCP.prototype.setKeepAlive = function (enable) {
var r = _setKeepAlive.apply(this, arguments);
this._ka = enable;
return r;
TCP.prototype.shutdown = function () {
var r = _shutdown.apply(this, arguments);
if (r && !this._ka), true, 150); // 150 sec
return r;

And this patch

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: