Skip to content
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

net.Server.listen's backlog option is no effect when use pm2 #1786

Closed
tangxinfa opened this issue Nov 24, 2015 · 6 comments
Closed

net.Server.listen's backlog option is no effect when use pm2 #1786

tangxinfa opened this issue Nov 24, 2015 · 6 comments

Comments

@tangxinfa
Copy link

My server's backlog set to 4096 when i call net.Server.listen

When start with pm2, backlog is 511(default value):

# ss -lt | grep 5170
LISTEN     0      511                     *:5170                     *:*       

If use node, backlog is 4096:

# ss -lt | grep 5170
LISTEN     0      4096                    *:5170                     *:*       

My server's node version: v0.12.7, pm2 version: 0.14.3

@tangxinfa
Copy link
Author

This problem looks like come from node.js 's cluster module, still don't know how to resolve it.

@Unitech
Copy link
Owner

Unitech commented Nov 25, 2015

What is that backlog?

@tangxinfa
Copy link
Author

There is a two example, i set backlog to 64:

Without cluster:

var http       = require('http');

http.createServer(function(req, res) {
    res.writeHead(200);
    res.end("hello world\n");
}).listen(3000, "0.0.0.0", 64);

ss -ltn | grep 3000 output:

LISTEN     0      64           *:3000                     *:*                  

With cluster

var cluster    = require('cluster'),
    http       = require('http');


if (cluster.isMaster) {
    cluster.fork();
} else {
    http.createServer(function(req, res) {
        res.writeHead(200);
        res.end("hello world\n");
    }).listen(3000, "0.0.0.0", 64);
}

ss -ltn | grep 3000 output:

LISTEN     0      511          *:3000                     *:*                  

The backlog take effect is 511 not 64, this means node cluster module NOT take care of the backlog option when we call listen: server.listen(port[, hostname][, backlog][, callback])

@tangxinfa
Copy link
Author

Already pulled a request to node: cluster, net: backlog need pass to listen #4056

@Unitech Unitech closed this as completed Jan 29, 2017
@eladnava
Copy link

eladnava commented Nov 30, 2021

Another PR (more recent), which is also now unfortunately closed due to lack of activity: nodejs/node#33827

@eladnava
Copy link

This is now fixed in PR nodejs/node#41623 and published in Node 17.6.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants