0
這款經典的集羣例如:集羣中的Node.js在蔚藍的模擬器或蔚藍色的VM失敗EBADF
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
cluster.on('exit', function(worker, code, signal) {
console.log('worker ' + worker.process.pid + ' died');
});
} else {
// Workers can share any TCP connection
// In this case its a HTTP server
// Worker code omitted
}
運行順利使用Windows Azure PowerShell和一個簡單的節點處理我的Windows機器,但是當我上部署它以蔚藍色的仿真器或一個真正的工人角色機器,我得到以下錯誤:
spawn EBADF
at errnoException (child_process.js:837:11)
at ChildProcess.spawn (child_process.js:789:11)
at exports.spawn (child_process.js:614:9)
at exports.fork (child_process.js:443:10)
at new Worker (cluster.js:288:20)
at Cluster.cluster.fork (cluster.js:474:11)
at Object.<anonymous> (X:\workspaces\tp\deploy\local_package.csx\roles\zealot\approot\server.js:8:13)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
任何人都知道爲什麼發生這種情況或如何調試這個問題?
感謝....
UPDATE:這個問題似乎只發生在節點引擎> = 0.8.0
UPDATE2:開設了一個問題https://github.com/joyent/node/issues/3779