New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Under stress, some connections keep open #15

Closed
revington opened this Issue Jan 8, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@revington
Copy link

revington commented Jan 8, 2016

Under stress some connections will stay on CLOSE_WAIT state.

To reproduce the issue:

$ node close-wait.js close-wait.js below
$ wrk --latency -t4 -c400 -d30s "http://localhost:8000"

$ ss -e | grep 8000 | grep CLOSE
tcp    CLOSE-WAIT 0      0            127.0.0.1:8000          127.0.0.1:40084    uid:1000 ino:2562644 sk:ffff8803a9e2db00 -->

Everytime I run the stress test a new connection (the first one) remains in CLOSE_WAIT state

close-wait.js

'use strict';
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
var proxiedHttp = require('findhit-proxywrap').proxy(http, {
    strict: false
});
var i;

if (cluster.isMaster) {
    // Fork workers.
    for (i = 0; i < numCPUs; i++) {
        cluster.fork();
    }

} else {

    // Workers can share any TCP connection
    // In this case it is an HTTP server
    proxiedHttp.createServer(function handler(req, res) {
        return res.end('ok');
    }).listen(8000);
}
@cusspvz

This comment has been minimized.

Copy link
Member

cusspvz commented Jan 8, 2016

Interesting... Is this test code intermittent or actually works every time?

We aren't using this at the time on production, but yet I could check it by today. ;)

@revington

This comment has been minimized.

Copy link
Author

revington commented Jan 8, 2016

It works everytime for me

@revington

This comment has been minimized.

Copy link
Author

revington commented Jan 12, 2016

wrk, makes a connection before performing the test (the test use another connection/s).
The behavior of node to this connection is different when http has been proxied with proxywrap.

Without proxywrap, node will (record no. 10) answer FIN ACK to wrk
without-proxywrap

With proxywrap, node will just (record no. 10) answer only ACK to wrk
with-proxywrap

revington added a commit to revington/proxywrap that referenced this issue Jan 13, 2016

@revington revington referenced this issue Jan 13, 2016

Merged

fix issue #15 #16

cusspvz pushed a commit that referenced this issue Jan 14, 2016

@cusspvz cusspvz closed this Jan 18, 2016

@cusspvz

This comment has been minimized.

Copy link
Member

cusspvz commented Jan 18, 2016

I've released 0.3.11, which includes your fix! Thanks once again.

@revington

This comment has been minimized.

Copy link
Author

revington commented Jan 19, 2016

You're welcome!

2016-01-18 15:54 GMT+01:00 José Moreira notifications@github.com:

I've released 0.3.11, which includes your fix! Thanks once again.


Reply to this email directly or view it on GitHub
#15 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment