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
In my code, I spawn 5 workers. The app server has an internal counter. If it exceeds 20, then it will app.close(), then process.exit() after 1 second, to make sure all existing request of the app are probably handle before the process ends. so that fugue can respawn the worker again.
here is my code:
app.get('/test', function(sReq, sRes) {
try {
var myCounter = counter ++;
console.log('test is called ' + myCounter);
if (myCounter >= 20) {
if (isServerClose) {
console.log("--- server is closed --- " + myCounter);
try {
sRes.send('ERROR 1 ');
} catch (ex) {
console.log(ex);
}
} else {
isServerClose = true;
var pids = fugue.workerPids();
console.log("--- server is going to stop --- " + myCounter + " Worker Id: " + fugue.workerId() + " ProcessId: " + process.pid );
try {
sRes.send('ERROR 2 ');
} catch (ex) {
console.log(ex);
}
app.close();
if (! fugue.isMaster()) {
setTimeout(function() {process.exit();}, 1000);
}
}
} else {
if (isServerClose) {
console.log("--- server is closed --- " + myCounter);
try {
sRes.send('ERROR 3 ');
} catch (ex) {
console.log(ex);
}
} else {
sRes.send('TEST');
}
}
} catch (ex2) {
console.log("bigger problem now... " + JSON.stringify(ex2));
}
});
When I do the test, let say , make 500 requests. Then it will crash.
net.js:841
throw new Error('The connection is not writable');
^
Error: The connection is not writable
at Socket._shutdown (net.js:841:11)
at Socket.flush (net.js:521:12)
at Socket.end (net.js:873:14)
at Carrier. (/usr/local/lib/node/.npm/fugue/0.1.2/package/lib/fugue.js:297:18)
at Carrier.emit (events.js:64:17)
at /usr/local/lib/node/.npm/carrier/0.1.1/package/lib/carrier.js:40:16
at Array.forEach (native)
at Socket. (/usr/local/lib/node/.npm/carrier/0.1.1/package/lib/carrier.js:26:13)
at Socket.emit (events.js:64:17)
at Socket._onReadable (net.js:678:14)
I think conn.end() call when the process doesn't exist anymore.
I don't know if it is a bug, or I kill the process in a wrong way. Please advice.
The text was updated successfully, but these errors were encountered:
In my code, I spawn 5 workers. The app server has an internal counter. If it exceeds 20, then it will app.close(), then process.exit() after 1 second, to make sure all existing request of the app are probably handle before the process ends. so that fugue can respawn the worker again.
here is my code:
app.get('/test', function(sReq, sRes) {
try {
var myCounter = counter ++;
console.log('test is called ' + myCounter);
When I do the test, let say , make 500 requests. Then it will crash.
net.js:841
throw new Error('The connection is not writable');
^
Error: The connection is not writable
at Socket._shutdown (net.js:841:11)
at Socket.flush (net.js:521:12)
at Socket.end (net.js:873:14)
at Carrier. (/usr/local/lib/node/.npm/fugue/0.1.2/package/lib/fugue.js:297:18)
at Carrier.emit (events.js:64:17)
at /usr/local/lib/node/.npm/carrier/0.1.1/package/lib/carrier.js:40:16
at Array.forEach (native)
at Socket. (/usr/local/lib/node/.npm/carrier/0.1.1/package/lib/carrier.js:26:13)
at Socket.emit (events.js:64:17)
at Socket._onReadable (net.js:678:14)
I think conn.end() call when the process doesn't exist anymore.
I don't know if it is a bug, or I kill the process in a wrong way. Please advice.
The text was updated successfully, but these errors were encountered: