-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Problem with cluster and passing connections to workers #7784
Comments
Is there a specific reason why you need to pass around connections in that way? I was able to run your stress test against the following code with no problems: var http = require('http');
var cluster = require('cluster');
if (cluster.isMaster) {
cluster.fork();
} else {
http.createServer(function(req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('okay');
}).listen(3000);
} |
Can sorta confirm:
|
@cjihrig - sorry for not providing more background. I came across this behavior when modeling a server after indutny's sticky-session. In a nutshell, Socket.IO's handshake requires multiple connections, and if we leave the distribution to the operating system, then connections related to a single handshake may end up in different workers. This of course makes Socket.IO not work reliably with node cluster, so the solution was to use file descriptor passing and accept connections in the master and pass them to workers according to source address. In other words, while the program you posted works for this particular test case, it doesn't generalize and fails when you try to use the same pattern with a Socket.IO server. :/ |
@elad Maybe this is the case? http://markdawson.tumblr.com/post/17525116003/node |
I'm not sure for several reasons:
So it seems like this is something server-side. But I have no idea, hence posting here. :) |
Same problem here. I wanted to implement a sticky-session like the module |
Currently when a server receives a new connection the underlying socket handle begins reading data immediately. This causes problems when sockets are passed between processes, as data can be read by the first process and thus never read by the second process. This commit allows sockets that are constructed with a handle to be paused initially. PR-URL: #8576 Fixes: #7905 Fixes: #7784 Reviewed-by: Trevor Norris <[email protected]>
Fixed by c2b4f48. |
Fantastic, thanks! Any estimate when v0.12 will be tagged and released? :) |
@elad Soon. I'm finishing the final patch that needs to land. Have had a training this week, so going to finish it up next week. |
@trevnorris Any news on it ? |
Hello,
I described this issue elsewhere (indutny/sticky-session#9) but since I can reproduce it on Ubuntu and Mac OS X in multiple environments and without sticky-session I'm posting it here for review.
dummy.js:
stress_dummy.js:
Install required modules:
Then run:
Terminal 1:
Terminal 2:
It very often happens that
stress_dummy
hangs without receiving responses to all ten requests.Thoughts?
The text was updated successfully, but these errors were encountered: