Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

AssertionError: false == true at SharedHandle.add (cluster.js:97:3) #9261

Closed

Description

@FLYBYME

Getting this error

assert.js:86
  throw new assert.AssertionError({
        ^
AssertionError: false == true
    at SharedHandle.add (cluster.js:97:3)
    at queryServer (cluster.js:480:12)
    at Worker.onmessage (cluster.js:438:7)
    at ChildProcess.<anonymous> (cluster.js:692:8)
    at ChildProcess.emit (events.js:129:20)
    at handleMessage (child_process.js:324:10)
    at Pipe.channel.onread (child_process.js:352:11)
$ node -v
v0.12.0

Activity

  1. cjihrig commented on Feb 22, 2015

    @cjihrig

    Thanks for reporting this. Can you please provide a reduced test case, with no external dependencies, that reproduces the issue?

  2. elliotstokes commented on Feb 25, 2015

    @elliotstokes

    I'm also getting this error. Happens when I try to make a udp request from a cluster.

  3. elliotstokes commented on Feb 25, 2015

    @elliotstokes

    test case. It will work first request and fail for the second.

    var cluster = require('cluster');
    var http = require('http');
    var dgram = require('dgram');
    var numCPUs = require('os').cpus().length;
    
    if (cluster.isMaster) {
      // Fork workers.
      for (var i = 0; i < numCPUs; i++) {
        cluster.fork();
      }
    
    } else {
    
      var server = http.createServer(function (request, response) {
        var client = dgram.createSocket("udp4");
        var message = new Buffer("Hello");
        client.send(message, 0, message.length, 80, "google.com", function(err, bytes) {
          client.close();
        });
        response.writeHead(200, {"Content-Type": "text/plain"});
        response.end("Hello World\n");
      });
    
      server.listen(1337);
    }
  4. elliotstokes commented on Feb 25, 2015

    @elliotstokes

    this doesn't look like it happens on 0.10.x only 0.12

  5. FLYBYME commented on Feb 25, 2015

    @FLYBYME
    Author

    I tracked it down to been UDP as elliotstokes did.

  6. elliotstokes commented on Feb 26, 2015

    @elliotstokes

    @FLYBYME did you find a workaround at all? i tried a few things but didn't get anywhere.

  7. cjihrig commented on Mar 1, 2015

    @cjihrig

    The solution to this is in #8643. It landed in master, but not 0.12. A workaround would be to create an exclusive UDP socket in your worker.

  8. rcrichton commented on Mar 20, 2015

    @rcrichton

    I'm getting the exact same problem and using node from master doesn't solve it. I'm only using UDP server sockets and I get the following when closing and restarting the UDP server:

    AssertionError: false == true
        at SharedHandle.add (cluster.js:99:3)
        at queryServer (cluster.js:482:12)
        at Worker.onmessage (cluster.js:440:7)
        at ChildProcess.<anonymous> (cluster.js:694:8)
        at ChildProcess.emit (events.js:131:20)
        at handleMessage (child_process.js:326:10)
        at Pipe.channel.onread (child_process.js:354:11)
    

    It works fine without using the cluster API, but breaks with it.

    $ node --version v0.13.0-pre

    See the above referenced commit if you want to see some code.

  9. nexflo commented on Mar 29, 2015

    @nexflo

    This is a major break for clustering (which is a core feature for node).
    Is there an ETA in which release this will appear?
    Thanks in advance.

  10. pungoyal commented on Apr 7, 2015

    @pungoyal

    This has become a major problem for us. Our processes keep getting killed. Workaround is to put a monitoring tool/script, but we'd rather not do that.

  11. cjihrig commented on Apr 7, 2015

    @cjihrig

    The following code (the original test case posted in this issue) works in master, but not 0.12, as #8643 did not land in 0.12. Do you have a reduced test case, written in JavaScript, with no external dependencies, that reproduces the problem against the master branch? If you are using 0.12, you may want to look into using the exclusive option with your UDP sockets.

    var cluster = require('cluster');
    var http = require('http');
    var dgram = require('dgram');
    var numCPUs = require('os').cpus().length;
    
    if (cluster.isMaster) {
      // Fork workers.
      for (var i = 0; i < numCPUs; i++) {
        cluster.fork();
      }
    
    } else {
    
      var server = http.createServer(function (request, response) {
        var client = dgram.createSocket("udp4");
        var message = new Buffer("Hello");
        client.send(message, 0, message.length, 80, "google.com", function(err, bytes) {
          client.close();
        });
        response.writeHead(200, {"Content-Type": "text/plain"});
        response.end("Hello World\n");
      });
    
      server.listen(1337);
    }
  12. elliotstokes commented on Apr 7, 2015

    @elliotstokes

    When is it going to be released? It's currently stopping me upgrading. I looked into the workaround but it didn't look like it was possible as the socket that causes the problems is created within the datagram code.

  13. cjihrig commented on Apr 7, 2015

    @cjihrig

    The master branch being released is probably still quite a while away. Here is a workaround in 0.12:

    var cluster = require('cluster');
    var http = require('http');
    var dgram = require('dgram');
    var numCPUs = require('os').cpus().length;
    
    if (cluster.isMaster) {
      // Fork workers.
      for (var i = 0; i < numCPUs; i++) {
        cluster.fork();
      }
    
    } else {
    
      var server = http.createServer(function (request, response) {
        var client = dgram.createSocket("udp4");
    
        client.bind({exclusive: true}, function() {
          var message = new Buffer("Hello");
          client.send(message, 0, message.length, 80, "google.com", function(err, bytes) {
            client.close();
          });
          response.writeHead(200, {"Content-Type": "text/plain"});
          response.end("Hello World\n");
        });
      });
    
      server.listen(1337);
    }
  14. 15 remaining items

  15. indutny commented on Aug 25, 2015

    @indutny
    Member

    Should be fixed by nodejs/node#2548

  16. nodesocket commented on Aug 25, 2015

    @nodesocket

    Will this go out in v0.12.8?

  17. indutny commented on Aug 25, 2015

    @indutny
    Member
  18. jasnell commented on Aug 25, 2015

    @jasnell
    Member

    I'll take a look. If the backport isn't too significant then it shouldn't be a problem getting it in. That said, we don't have a clear timeline for v0.12.8 yet so we'll have to figure that out as well.

  19. self-assigned this
    on Aug 25, 2015
  20. violet-day commented on Sep 14, 2015

    @violet-day

    +1

  21. austinkelleher commented on Sep 14, 2015

    @austinkelleher

    Just a heads up, the issues I was experiencing with cluster have been resolved in 4.0.0.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions