Open jslegers opened 5 years ago
The launcher is supposed to see browser_process_failure
and exit.
https://github.com/karma-runner/karma/blob/c311ac00cef4a957f889ed613238793c0ffa95a2/lib/launchers/base.js#L111
For some reason this does not happen in your case.
To solve this we need to add encapsulated management of the state
of launcher and log its transitions. We did this for browser in #3202. Then --logLevel=DEBUG will guide us to the issue.
To solve this we need to add encapsulated management of the
state
of launcher and log its transitions. We did this for browser in #3202.
I'm not entirely sure what you're saying here.
Anyway, do you need anything from me for this?
If you want to try to debug your issue you can add logging to the copy of karma-runner base.js
to see what values prevent the line above from being executed. Since there is no practical way for us to reproduce your issue, ultimately better logging is all we can do.
I spent some time debugging this issue. You can easily reproduce it by setting an extremely low captureTimeout
(like 2ms). When trying to run multiple browsers, you'll notice that Karma hangs after giving up on restarts.
Upon further investigation, I noticed that the browser_process_failure
listener in https://github.com/karma-runner/karma/blob/13ed69522bb19a2d26b61fe72f1ce43b64ac30c3/lib/launcher.js#L77 is never invoked.
The event is emitted in https://github.com/karma-runner/karma/blob/13ed69522bb19a2d26b61fe72f1ce43b64ac30c3/lib/launchers/base.js#L121. Emitting the event on this
(similar to the done
event a few lines above it), fixes the issue:
if (this.error && this.state !== BEING_FORCE_KILLED && this.state !== RESTARTING) {
emitter.emit('browser_process_failure', this) // trigger the server's event listener
this.emit('browser_process_failure') // trigger the launcher's event listener
}
Not sure if this is the proper way to fix this, but at least now we know why it is hanging.
I'm starting my Karma like this (in Java) :
This starts the following script :
Due to some issue with Firefox on one of our Jenkins slaves, Karma behaves like this :
This causes Karma to become unresponsive and will result in the process reaching a timeout after 20 minutes.
Is there any was I can get this process to end immediately, so I don't block my Jenkins slave for nothing?