Skip to content
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

Re-executes tests continuously in the same browser (race condition bug) #613

Closed
ernestoalejo opened this issue Jul 1, 2013 · 6 comments
Closed

Comments

@ernestoalejo
Copy link

I'm using Karma version: 0.9.4 (but the stable one has the same problem too).

Command: karma start config/karma.conf.js --log-level debug

Some kind of strange race condition occurs randomly that makes karma run tests, disconnects half the way; reconnect; run two or three set of tests in the same browser instance (as if they would be different browsers) and then disconnect some of them.

After the ignored files debug messages this is the debug log. It's important to note I didn't touched any file so only one run should have been made here:

DEBUG [karma]: New browser has connected on socket Nr6eEqsamhsgN5TSisUU
INFO [Chrome 29.0.1547 (Linux)]: Connected on socket id Nr6eEqsamhsgN5TSisUU
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
Chrome 29.0.1547 (Linux): Executed 113 of 113 SUCCESS (0.707 secs / 0.458 secs)
DEBUG [watcher]: Excluding /home/ernesto/projects/mailing/client/app/components/bower-angular/angular-scenario.js
DEBUG [watcher]: Excluding /home/ernesto/projects/mailing/client/config/karma.conf.js
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
DEBUG [web server]: serving: /home/ernesto/projects/mailing/client/test/unit/controllers/logsSpec.js
Chrome 29.0.1547 (Linux): Executed 113 of 113 SUCCESS (0.903 secs / 0.414 secs)
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/client.html
WARN [Chrome 29.0.1547 (Linux)]: Disconnected
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/karma.js
DEBUG [karma]: New browser has connected on socket GKJG1ZTjOib1a84gisUV
INFO [Chrome 29.0.1547 (Linux)]: Connected on socket id GKJG1ZTjOib1a84gisUV
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
Chrome 29.0.1547 (Linux): Executed 98 of 113
Chrome 29.0.1547 (Linux): Executed 113 of 113 SUCCESS (0.792 secs / 0.548 secs)
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/karma.js
DEBUG [karma]: New browser has connected on socket FV2Cz6kY4eEWhDsRisUW
INFO [Chrome 29.0.1547 (Linux)]: Connected on socket id FV2Cz6kY4eEWhDsRisUW
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
Chrome 29.0.1547 (Linux): Executed 0 of 0
Chrome 29.0.1547 (Linux): Executed 113 of 113 SUCCESS (0.563 secs / 0.412 secs)
Chrome 29.0.1547 (Linux): Executed 0 of 0 DISCONNECTED (0.035 secs / 0 secs)

I think it's related to the error that makes PhantomJS run tests & restart without stop:

DEBUG [karma]: New browser has connected on socket Jtz6rwd54LMYfp_zkVnb
INFO [PhantomJS 1.8.2 (Linux)]: Connected on socket id Jtz6rwd54LMYfp_zkVnb
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
PhantomJS 1.8.2 (Linux): Executed 0 of 0
PhantomJS 1.8.2 (Linux): Executed 93 of 113
PhantomJS 1.8.2 (Linux): Executed 113 of 113 SUCCESS (0.376 secs / 0.281 secs)
PhantomJS 1.8.2 (Linux): Executed 0 of 0 DISCONNECTED (0.005 secs / 0 secs)
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/karma.js
DEBUG [karma]: New browser has connected on socket NJJ-l1EDklmk4wqAkVnc
INFO [PhantomJS 1.8.2 (Linux)]: Connected on socket id NJJ-l1EDklmk4wqAkVnc
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
PhantomJS 1.8.2 (Linux): Executed 0 of 0
PhantomJS 1.8.2 (Linux): Executed 95 of 113
PhantomJS 1.8.2 (Linux): Executed 113 of 113 SUCCESS (0.369 secs / 0.273 secs)
PhantomJS 1.8.2 (Linux): Executed 0 of 0 DISCONNECTED (0.007 secs / 0 secs)
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/karma.js
DEBUG [karma]: New browser has connected on socket -vj-wjYf5vnpX2RSkVnd
INFO [PhantomJS 1.8.2 (Linux)]: Connected on socket id -vj-wjYf5vnpX2RSkVnd
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
PhantomJS 1.8.2 (Linux): Executed 0 of 0
PhantomJS 1.8.2 (Linux): Executed 95 of 113
PhantomJS 1.8.2 (Linux): Executed 0 of 0 DISCONNECTED (0.006 secs / 0 secs)
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/client.html
^CDEBUG [launcher]: Disconnecting all browsers
DEBUG [launcher]: Killing PhantomJS

@ernestoalejo
Copy link
Author

If you need more logs or debug info I can reproduce the bug in my computer every time I run the tests.

@vojtajina
Copy link
Contributor

Can you send the debug output again, but using --reporters dots (because the default progress reporter is rewriting terminal and it clobbers the logs).

@ernestoalejo
Copy link
Author

The DEBUG-some tests-DEBUG-again-two-tests-more cycle it's repeated 10 times before it stops the first execution. I've copied only the first 4 because they're similar. I have only the browser & the console opened this time, so no Sublime interference it's possible.

DEBUG [karma]: New browser has connected on socket 47Q5K0B_317_QzYlxSvY
INFO [Chrome 29.0.1547 (Linux)]: Connected on socket id 47Q5K0B_317_QzYlxSvY
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
................................................................................
...........................................DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/client.html
.....................
Chrome 29.0.1547 (Linux): Executed 144 of 144 SUCCESS (0.725 secs / 0.57 secs)
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/karma.js
DEBUG [karma]: New browser has connected on socket roYKgIHP0BPEHTC4xSvZ
INFO [Chrome 29.0.1547 (Linux)]: Connected on socket id roYKgIHP0BPEHTC4xSvZ
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
WARN [Chrome 29.0.1547 (Linux)]: Disconnected
................................................................................
..............................................................DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/client.html
..
Chrome 29.0.1547 (Linux): Executed 144 of 144 SUCCESS (0.674 secs / 0.506 secs)
Chrome 29.0.1547 (Linux): Executed 0 of 0 DISCONNECTED (0.032 secs / 0 secs)
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/karma.js
DEBUG [karma]: New browser has connected on socket CHxj569tqvu_dVMcxSva
INFO [Chrome 29.0.1547 (Linux)]: Connected on socket id CHxj569tqvu_dVMcxSva
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
WARN [Chrome 29.0.1547 (Linux)]: Disconnected
................................................................................
...............................................................DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/client.html
.
Chrome 29.0.1547 (Linux): Executed 144 of 144 SUCCESS (0.66 secs / 0.51 secs)
Chrome 29.0.1547 (Linux): Executed 0 of 0 DISCONNECTED (0.023 secs / 0 secs)
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/karma.js
DEBUG [karma]: New browser has connected on socket u_rpV3PO9euW1lI5xSvb
INFO [Chrome 29.0.1547 (Linux)]: Connected on socket id u_rpV3PO9euW1lI5xSvb
DEBUG [karma]: All browsers are ready, executing
DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/context.html
WARN [Chrome 29.0.1547 (Linux)]: Disconnected
................................................................................
..............................................................DEBUG [web server]: serving: /usr/local/lib/node_modules/karma/static/client.html
..
Chrome 29.0.1547 (Linux): Executed 144 of 144 SUCCESS (0.655 secs / 0.503 secs)
Chrome 29.0.1547 (Linux): Executed 0 of 0 DISCONNECTED (0

@vojtajina
Copy link
Contributor

I think some of your tests reloads the full page.

There's an open issue for fixing this #27

@ernestoalejo
Copy link
Author

I will investigate further trying to see what test is the cause of this reload

@ernestoalejo
Copy link
Author

It was a location.href = '/'; I was inadvertently activating. Closing this issue as #27 is tracking the problem further.

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

No branches or pull requests

2 participants