-
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
Karma 0.13.19 taking long time to complete when run via gulp #1788
Comments
I'm currently implementing karma with gulp for the first time and can confirm this. |
+1 caused by 3ab78d6 |
Until this issue is resolved, here's a simple workaround: Patch your package.json: "devDependencies": {
...
"karma": "=0.13.18",
"socket.io": "1.3.7",
...
}, |
This might also be caused by an internal change in [email protected] |
`karma` was taking a long time (~30s) to exit the test suites when it is run from `gulp`. There is an ongoing issue and the temporary workaround is to keep the `karma` version at `1.3.7`. karma-runner/karma#1788
ditto here |
Also having this problem. |
Same problem here. [Mac (node 5.4.1, npm 3.3.12, gulp 3.9.0, karma 0.13.19)] |
Same issue. It works after changed to sockect.io 1.3.7 as mentioned by @lukaselmer. Please fix. |
using socket.io 1.3.7 might not be a good advice cause it has a security issue that has been fixed with 1.4.0 |
OK, I think I may have found the offending code. I can fork this and try the fix later, unless someone else gets around to it first. Suspected offending commit: 3ab78d6 Suggested possible fix: for (var id in sockets) {
if (sockets.hasOwnProperty(id)) {
sockets[id].disconnect();
}
} Also, this line seems suspect: var sockets = socketServer.sockets.sockets // sockets.sockets? Is this correct? Also, looking at the Socket.Io code, it seems there's already a Hazarding a guess (can potentially replace Karma's workaround?): socketServer.disconnect(); // and.... done! Thoughts welcomed.
|
@therealklanni I wish it was that simple, but sadly it isn't if you read the the git history and the comments surrounding that code you see that there are issues inside socket.io that we are working around, and some in our own code which makes it right now necessary to hack into the sockets list and disconnect them manually. I believe if socketio/socket.io#2069 gets fixed we should be able to fix this properly but I don't see a good way to workaround this at the moment. |
Seems like the issue is resolved by using socket.io 1.4.5 socketio/socket.io@b3fc530! Thanks! |
@lukaselmer - Good spot! I've just tried this out locally and can confirm that by bumping the version of With that in mind, is the only actionable thing here required for Karma, to release a new minor version with the bumped version? |
You can just run npm update on your installation, as 1.4.5 is in the dependency range of karma already. There is version bump in |
We are still seeing this issue, specifically when running Gulp with Karma and phantomjs. There is a 30 second delay between tests completing and the Gulp process exiting when upgrading from Using
Using
The Gulp task is:
The above Gulp task completes and exits immediately when using For testing this issue I can confirm
Please let me know if I can add any further version numbers or information. |
I've seen this myself, that after pointing at |
Hey @dignifiedquire, Thank you for your continued assistance in tracking this down!
I was not able to install either of chrome not chromium inside our headless Vagrant Ubuntu based VM, which is where the tests currently run - this mirrors our CI server. I can confirm that I don't experience the 30 second delays running your test repo with Chrome under OSX 10.11.3. Interestingly enough, when I revert phantomJS on our VM back to It is starting to look like PhantomJS 2.x is responsible for this issue, at least in our test setup which is installed as a karma-runner/karma-phantomjs-launcher For us, the current solution is to explicitly require PhantomJS 1.9.19 and to revert karma-runner/karma-phantomjs-launcher back to
It would be interesting to hear if anybody else experiencing the 30 second delay issues is also using PhantomJS 2.x |
@dignifiedquire The issue is definitely related to phantomJS 1.9.x. There isn't any time delay problem while I used Firefox and/or Chrome. |
@nazar Seeing the same thing here. After doing some digging: The 30 second timeout is from https://github.com/websockets/ws/blob/master/lib/WebSocket.js#L129, where if the WebSocket is closed uncleanly (without close acknowledgement from the client), the socket goes into limbo mode, waiting to receive this ack before fully closing out. It seems like Karma, in Regarding PhantomJS versions, I was able to reproduce this both with PhantomJS 2.x and with PhantomJS 1.9.8 + karma-phantomjs-launcher 0.2.3. Current workaround is to revert to karma 0.13.9, karma-phantomjs-launcher 0.2.1 which we were previously using. |
This bug is still there for me using Karma 0.13.21, downgrading to 0.13.9 resolves |
I've experienced the bug in |
@keirlawson Locking to As a side note, |
All versions from 0.13.10 and 0.13.22 seem to contain the bug. We also downgraded to 0.13.9. |
Still seeing this issue. Downgrading to 0.13.9 is an issue because it doesnt like node 4.3... im seeing: |
I can confirm this. I'm not using gulp, but Karmas Node API. I switched back to |
Still an issue for me even when using karma 0.13.9 and karma 0.13.22. |
@danielpacak is attempting to update the gulp karma docs. his technique works well: |
I am also seeing this on version 1.1.1. |
- Done based on complaints about tests hanging on the current versions. - See karma-runner/karma#1788
The technique suggested by @arshaw works if you only want to start a single run, but tasks you defined to run afterwards will not be executed. EDIT: At least that is the case for me, when using it together with run-sequence. The reason for this being, that if there is no done callback function provided to
This however put me back to square one. Now the process isn't exiting again, after completion. |
I also had this issue. I was able to fix it with a workaround provided here: karma-runner/gulp-karma#23 (comment) |
Having the same issue with fresh new angular2 app made with angular cli: http://stackoverflow.com/questions/42030568/how-to-manage-to-exit-phantomjs-launcher-after-tests-execution |
Still seeing this issue with karma version 1.4.1. I.e. after the gulp tasks have completed and results have been output to console there is a roughly ~35 second delay before the process fully exits. Manually counted to around ~35 seconds on my local relatively powerful Ubuntu desktop machine while the pipelines I've seen on our CI on Codeship repeatedly got around the same value of 35 seconds +/- 2 seconds maybe. Quick-fix using karma-runner/gulp-karma#23 (comment) as linked by @Dinistro. const gulp = require('gulp'); // @4.0.0-alpha.2
const gutil = require('gulp-util'); // @3.0.7:
gulp.task('karma:single-run', karmaSingleRun);
function karmaSingleRun(done) {
const childProcess = require('child_process');
childProcess.exec('./node_modules/karma/bin/karma start conf/karma.conf.js', (err, stdout) => {
gutil.log(stdout);
if (err) {
throw new Error('There are test failures');
} else {
done();
}
});
} Curious if this still or again has something to do with the manual socket disconnects that Karma does, which was discussed earlier in this thread. Or if it is something upstream like the tag suggests. Do we need to create a new issue or will this be re-opened? EDIT: Previous version of course does not run on Windows. Here is a version that works on Windows as well (though it also requires an additional gulp library): const gulp = require('gulp'); // @4.0.0-alpha.2
const shell = require('gulp-shell'); // @0.5.2
const gutil = require('gulp-util'); // @3.0.7:
gulp.task('karma:single-run', shell.task([
'karma start <%= configFile %>'
], {
verbose: true,
templateData: {
configFile: configFile
}
})); |
@nazar I'm having this issue with PhantomJS 2.1.1, but reverting to 1.9.7 (by substituting it on the PATH and PHANTOMJS_BIN at runtime) fixes it. |
Karma has some issues letting go after the test run. Ref karma-runner/karma#1788 and ampproject/amphtml#14814 This fix basically forces aegir to close after the karma tests have been successfully run, so instead of a test-run taking 13 seconds for the tests to run then 30 seconds for karma to force-close, it finishes in 14 seconds. Solves #212
I am opening a new ticket as this seems to be fallout from #1782 and the socket.io upgrade to 1.4.0.
I've just noticed a side effect from upgrading to 0.13.19; gulp karma test tasks take much longer to exit after the test run.
Previously the above task used to complete immediately after tests have completed. on 0.13.9, there is a pause of ~30 seconds after the karma runner completes the tests and the task exits.
The above outputs done to the console but the gulp task still doesn't complete until after ~30 seconds.
cc @nazar
The text was updated successfully, but these errors were encountered: