GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Server.getConnections() failed with "Slave closed before reply" · Issue #13923 · nodejs/node

Server.getConnections() failed with "Slave closed before reply" #13923

New issue
Copy link
New issue
Copy link
Closed
Closed
Server.getConnections() failed with "Slave closed before reply"#13923
Copy link
Labels
clusterIssues and PRs related to the cluster subsystem.netIssues and PRs related to the net subsystem.

Description

@kavinwang
kavinwang
opened on Jun 26, 2017
Issue body actions

node version : 4.x - 6.x
os: macos linux

save the following codes to a file like 'server.js', and run node server.js
then run this test code in another console:

for i in {1..1500}; do curl http://localhost:12345; sleep 1; echo "---- $i\n"; done

server.js :

'use strict';
var cluster = require('cluster');
var net = require('net');
if (cluster.isMaster) {
    console.log('Nodejs version :', process.version);
    var cpuCount = require('os').cpus().length;
    var workers = [];

    var spawn = function(workerIndex) {
        var worker = cluster.fork();
        workers[workerIndex] = worker;
        worker.on('exit', function() {
            spawn(workerIndex);
        });
    };
    for (var i = 0; i < cpuCount; i++) spawn(i);

    var masterHttpServer = net.createServer({ pauseOnConnect: true }, function(socket) {
        //var worker = workers[Number('0' + socket.remoteAddress.replace(/[abcdef:.]/g, '')) % cpuCount];
        var worker = workers[0];
        worker.send('xxx-http-session:connection', socket);
    }).listen(12345);

    setInterval(function() {
        //XXX: will return errors if some worker dies with unclosed socket
        masterHttpServer.getConnections(function(err, counts) {
            if (!err) console.info('active connections : ' + counts);
            else console.info('errors ocurred when getConnections :' + err);
        });
    }, 1000);

    setInterval(function() {
       workers[0].kill();
    }, 1000);

} else {
    var server = require('http').createServer(function(req, res) {
        res.end('Anythings returns to the browser! ');
    });

    process.on('message', function(message, socket) {
        if (message !== 'xxx-http-session:connection') return;
        server.emit('connection', socket);
        socket.resume();
    });
}

process.on('uncaughtException', function(err) {
    console.log('uncaughtException:', err.stack);
});
process.on('exit', function(code) {
    console.warn('process is down ! exit code :', code);
});

Server.getConnections() will fail with "Slave closed before reply"; and will nerver come back !

output:

Nodejs version : v6.11.0
active connections : 0
errors ocurred when getConnections :Error: Slave closed before reply
errors ocurred when getConnections :Error: Slave closed before reply
errors ocurred when getConnections :Error: Slave closed before reply
errors ocurred when getConnections :Error: Slave closed before reply
errors ocurred when getConnections :Error: Slave closed before reply
errors ocurred when getConnections :Error: Slave closed before reply
errors ocurred when getConnections :Error: Slave closed before reply

I think that is a bug !
thanks!

Activity

  1. mscdex
    added
    netIssues and PRs related to the net subsystem.
    clusterIssues and PRs related to the cluster subsystem.
    on Jun 26, 2017
  2. XadillaX commented on Jul 11, 2017

    @XadillaX
    XadillaX
    on Jul 11, 2017
    Contributor
    More actions

    Can you minify your code to reproduce this problem?

    Reacted by Gibson Fahnestock and kavinwang
  3. apapirovski commented on Apr 12, 2018

    @apapirovski
    apapirovski
    on Apr 12, 2018
    Contributor
    More actions

    Given the lack of a follow up and no one taking this up, I'm going to go ahead and close. If anyone happens to have any additional information or believes this should remain open, please feel free to do so. Just cleaning up the issue tracker a tad...

  4. apapirovski
    closed this as completedon Apr 12, 2018
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

    clusterIssues and PRs related to the cluster subsystem.netIssues and PRs related to the net subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.