Skip to content

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

Closed

Description

@tangxinfa

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

Activity

  1. tangxinfa commented on Nov 24, 2015

    @tangxinfa
    Author

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

  2. Unitech commented on Nov 25, 2015

    @Unitech
    Owner

    What is that backlog?

  3. tangxinfa commented on Nov 26, 2015

    @tangxinfa
    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])

  4. tangxinfa commented on Nov 28, 2015

    @tangxinfa
    Author
  5. eladnava commented on Nov 30, 2021

    @eladnava

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

  6. eladnava commented on Feb 25, 2022

    @eladnava

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions