You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
cluster.js: a straightforward recluster configuration
node.js: an example webserver, copy-pasted from nodejs.org, tweaked a tiny bit
To reproduce
File 'cluster.js':
constpkg=require('./package');constpath=require('path');constnumCPUs=require('os').cpus().length;constrecluster=require('recluster');varapp=path.join(__dirname,pkg.main);varoptions={workers: numCPUs,readyWhen: 'ready'};varcluster=recluster(app,options);cluster.run();console.log('Cluster started with',numCPUs,'nodes.');
File 'node.js':
consthttp=require('http');constWORKER_ID=parseInt(process.env.WORKER_ID,10)||0;varserver=http.createServer(function(req,res){res.end('Hello World from worker '+WORKER_ID);}).listen(3000+WORKER_ID,'127.0.0.1');server.on('listening',function(){// Signal recluster that this node is ready.if(process.send){process.send({cmd: 'ready'});}});
Run:
node --harmony cluster
Wait 5 minutes (it never crashes right after starting the cluster)
Request http://localhost:3000/, which will time out
Look at your terminal window, it crashed with the error above: Assertion failed: cb->IsFunction(), file g:\jenkins\workspace\nodejs-msi\d73b0901\src\async-wrap-inl.h, line 230
The bad news? It doesn't always crash. I hope you guys can reproduce. If further environment info is needed, or I should run some other tests, let me know.