question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cluster functionality broken in nexe

See original GitHub issue

Is this a BUG or a FEATURE REQUEST?: Bug

What happened: Cluster module functionality is broken in the current version of nexe.

The primary sample from the node.js docs does not function properly:

# example taken from https://nodejs.org/api/cluster.html
> cat test.js
const cluster = require('cluster');
const http = require('http');
const numCPUs = require('os').cpus().length;

if (cluster.isMaster) {
  console.log(`Master ${process.pid} is running`);

  // Fork workers.
  for (let i = 0; i < numCPUs; i++) {
    cluster.fork();
  }

  cluster.on('exit', (worker, code, signal) => {
    console.log(`worker ${worker.process.pid} died`);
  });
} else {
  // Workers can share any TCP connection
  // In this case it is an HTTP server
  http.createServer((req, res) => {
    res.writeHead(200);
    res.end('hello world\n');
  }).listen(8000);

  console.log(`Worker ${process.pid} started`);
}

> node test.js
Master 5133 is running
Worker 5141 started
Worker 5153 started
Worker 5160 started
Worker 5161 started
Worker 5147 started
Worker 5140 started

> nexe -t node-12.0.0-linux-x64 -o test test.js
> ./test
Master 5183 is running

What you expected to happen: The example from the node.js docs should generate identical output for nexe bundled binary and node runtime execution

How to reproduce it (as minimally and precisely as possible): Compare the example from the cluster api documentation between running via node and running via nexe bundled executable

Anything else we need to know?: Lemme know 😃

Environment Dev desktop?

  • Platform(OS/Version): Ubuntu 18.04

  • Host Node Version:

  • Target Node Version: 12.3.1

  • Nexe version: 3.2.1

  • Python Version: 2.7.15

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
calebboydcommented, Jun 12, 2019

Closed via 1023b72513cfbf4b36ccfa0ce4c19f719e2aa994

Builds should trickle in over the next few days

1reaction
calebboydcommented, Jun 11, 2019

@EricMCornelius It looks like the workers are being bootstrapped earlier than they used to be relative to when nexe initializes. I’ll think on how this might be fixed…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cluster service fails to start troubleshooting guidance
Provides guidance for when a cluster service fails to start in a Windows-based failover cluster.
Read more >
clustering in node.js is not working. Only one worker is always ...
yes it is a fake/traffic load. I am experimenting with cluster framework. problem is only one request is being served by one worker...
Read more >
1461865 – AWS getInstancesByNodeNames is broken for large ...
Summary: AWS getInstancesByNodeNames is broken for large clusters ... all features (such as Load Balancers, Storage) which rely on this function to work....
Read more >
Clusters: HarfBuzz Manual
In text shaping, a cluster is a sequence of characters that needs to be treated as ... to ensure that the cluster is...
Read more >
Cluster | Node.js v19.3.0 Documentation
setupPrimary([settings]); cluster.worker; cluster.workers ... In a worker, this function will close all servers, wait for the 'close' event on those servers ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found