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

Cluster losts handle when data size is large #13778

Closed
goleoh opened this issue Jun 19, 2017 · 2 comments
Closed

Cluster losts handle when data size is large #13778

goleoh opened this issue Jun 19, 2017 · 2 comments
Labels
cluster Issues and PRs related to the cluster subsystem. confirmed-bug Issues with confirmed bugs. net Issues and PRs related to the net subsystem.

Comments

@goleoh
Copy link

goleoh commented Jun 19, 2017

  • Version: 4, 5, 6, (7, 8 maybe?)
  • Platform: linux
  • Subsystem:

when master to worker with some data with socket
and worker sends the received data to the master back with socket,
if the data size is above 10KB the socket disappeared.
here is the sample code

const cluster = require('cluster');
const net = require('net');

var doWork = function(worker) {
   var sock = new net.Socket();
   // available port and host
    sock.connect(443, 'google.com', function() {

        var data = [];
        for(var i=0; i<30000; i++) {
            data[i] = '1';
        };
       // 1. send to worker data with socket
        console.log('master to worker with socket %s', sock);
        worker.send({cmd:'syn', data:data}, sock);
    });
};

if ( cluster.isMaster ) {
    var num = 5;
    var workers = [];
    for(var i=0; i<num; i++) {
        workers[i] = cluster.fork();
        workers[i].on('message', function(m, h) {
            // 3. received from worker, socket is undefined.
            console.log('admin recv m %s, h %s, isNS', m.cmd, h, h? h instanceof net.Socket : 'na');
        });
    }
    for(var i=0; i<num; i++) {
        doWork(workers[i]);
    }
} else {
    process.on('message', function(m, h) {
       // 2. worker send data to master with socket
        console.log('worker m %s, h %s, isNS', m.cmd, h, h ? h instanceof net.Socket : 'na');
        process.send({cmd:'ack', data:m.data}, h);
    });
}
@mscdex mscdex added cluster Issues and PRs related to the cluster subsystem. net Issues and PRs related to the net subsystem. labels Jun 19, 2017
@addaleax addaleax added the confirmed-bug Issues with confirmed bugs. label Aug 1, 2017
addaleax added a commit to addaleax/node that referenced this issue Aug 7, 2017
Fix situations in which the handle passed along with a message
that has a large payload and can’t be read entirely by a single
`recvmsg()` call isn’t associated with the message to which it
belongs.

Fixes: nodejs#13778
@jasnell jasnell closed this as completed in 611851d Aug 8, 2017
addaleax added a commit that referenced this issue Aug 9, 2017
Fix situations in which the handle passed along with a message
that has a large payload and can’t be read entirely by a single
`recvmsg()` call isn’t associated with the message to which it
belongs.

PR-URL: #14588
Fixes: #13778
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
@MatanYemini
Copy link

I see something similar when using cluster mode v16.17.0

@MatanYemini
Copy link

100KB request results in total chunks length of 65K+-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cluster Issues and PRs related to the cluster subsystem. confirmed-bug Issues with confirmed bugs. net Issues and PRs related to the net subsystem.
Projects
None yet
Development

No branches or pull requests

4 participants