I noticed that an example from the node.js documentation was behaving in an unexpected way. It is the second example for the Cluster module. You can see it on both of these pages:
- http://nodejs.org/docs/v0.6.9/api/cluster.html
- http://nodemanual.org/latest/nodejs_ref_guide/cluster.html
First off, note that the nodemanual.org examples link to the Cloud9 IDE, which doesn't support the Cluster module -- it might be nice to note this to save a lot of people the trouble of finding it out for themselves.
The behavior I was seeing is that "numReqs" was increasing by 2: 0, 2, 4... instead of the expected 0, 1, 2...
On the node.js IRC channel, I was helped by bnoordhuis & AndreasMadsen.
At first the problem seemed to be that I had a userland Cluster module. I think it might be helpful to add notes to the documentation, stating in which node.js version a module moved into or out of node-core.
Finally, I began to think that it was an issue with my browser or my network. Turns out it is a Chrome issue. See http://code.google.com/p/chromium/issues/detail?id=39402 -- essentially Chrome is requesting '/favicon.ico' after each request (until it receives a valid favicon, which in this case never happens).
The following code shows the issue clearly, as well as returning a more sane response to the '/favicon.ico' request.
I wouldn't go so far as to suggest that the example be changed to the code below, but I think it should be reworked ever so slightly so as to be less confusing to others using Chrome as their browser.
When AndreasMadsen was helping me (IRC) he sent the following Gist, which also has some nice changes relative to the original example: https://gist.github.com/1719892 -- for example, he added a closure in order to identify each worker.