Skip to content
This repository has been archived by the owner on Feb 27, 2022. It is now read-only.

frequently two disconnects will be required to disconnect a worker. #4

Open
isaacs opened this issue Aug 8, 2012 · 2 comments
Open

Comments

@isaacs
Copy link
Owner

isaacs commented Aug 8, 2012

Not sure why this is. It's like the first one is being ignored.

Maybe because npm-www starts up 2 servers?

@ghost
Copy link

ghost commented Aug 17, 2012

In my experience, calling .disconnect() a second time on a worker will cause it to disconnect immediately, ignoring any current ._connections open from a httpServer in that worker.

Also from what I can tell (using express / cluster) ._connections stay open on httpServer's for a long period of time (>30 seconds?) after a page request has been fulfilled, so any recently used workers won't die from a single disconnect for that long period of time.

Not sure if your two disconnects was related to the former, or your frequently was related to the latter, but wanted to share both tidbits anyways in case it's helpful.

@tim-kos
Copy link

tim-kos commented Feb 25, 2014

I am struggling with the exact same issue.

To easily reproduce this, do the following:

master.js contains https://gist.github.com/tim-kos/0da0f2f6559646aa2076
server-worker.js (in the same directory) contains: https://gist.github.com/tim-kos/2acb5589b33403cad80b

Start master.js, go to localhost:8000 and see the server output. Then change the output around in server-worker.js from "hello world8" to "hello world9", etc. Do this as often as you want and keep refreshing your browser page. I have seen outputs from workers whose version is 3 restarts old ... and it's likely that it's related to this issue.

Here is my log output in case it's useful: https://gist.github.com/tim-kos/a2f16a644ad788512300 Please note the "Already restarting. Cannot restart yet." messages (expected) and the "Error: IPC channel is already disconnected" errors (not expected).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants