-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server(config, callback).start() causes node process to hang #2867
Comments
Can you create a (failing) test in this repo as a PR to illustrate the problem? |
I can attempt to make one, its a little tricky because the bug is in karma not releasing the node instance, so the test would have to verify that the node instance exited (I'm not familiar with writing a test like that). |
Heya, I was faced with a similar problem today. As far as I can tell, it's because browser disconnection is setup on single run mode: But not on watch mode. So on watch mode even if you do something like
Karma would never really exit since the browsers are not disconnected. I tried my hand at a PR for this in #2946. |
Actually, now that I read the original issue again, I'm not too sure my analysis and fix suit. The original issue is for |
Expected behaviour
When a karma server has finished running, it should clean up so that node can exit, e.g.:
Actual behaviour
The node process hangs, and doesn't exit for upwards of a few minutes.
Environment Details
Steps to reproduce the behaviour
Note: This isn't 100% repo (as sometimes
writeBuffer
is empty when karma server calls.disconnect
on the socket, see below for more details).node runkarma.js
Cause
From debugging under node --inspect I see an engine.io socket stays alive preventing node from exiting.
Furthermore I see its caused by the
writeBuffer
containing messages preventingcloseTransport
from being called.file: engine.io\lib\socket.js
Even more specifically its because the socket needs to cleanup the pingTimeout, which is done inside onClose which is called by closeTransport.
Note
Although the default behavior is to have the callback call process.exit, it doesn't work in our environment because:
The text was updated successfully, but these errors were encountered: