karma-runner / karma-chrome-launcher

A Karma plugin. Launcher for Chrome and Chrome Canary.
MIT License
467 stars 120 forks source link

karma crashes when chrome is already running #34

Open Steditor opened 9 years ago

Steditor commented 9 years ago

When launching the karma test with chrome already running, three karma tabs open, connect, lose the connection again and then karma crashes. When you close two of the tabs fast enough, everything works.

INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
DEBUG [temp-dir]: Creating temp dir at C:\Users\[...]\AppData\Local\Temp\karma-40710999
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=C:\Users\[...]\AppData\Local\Temp\karma-40710999 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate ht
tp://localhost:9876/?id=40710999
DEBUG [framework.browserify]: building bundle
DEBUG [framework.browserify]: adding [...] to bundle
DEBUG [launcher]: Process Chrome exited with code 0
ERROR [launcher]: Cannot start Chrome

DEBUG [temp-dir]: Cleaning temp dir C:\Users\[...]\AppData\Local\Temp\karma-40710999
INFO [launcher]: Trying to start Chrome again (1/2).
DEBUG [launcher]: Restarting Chrome
DEBUG [temp-dir]: Creating temp dir at C:\Users\[...]\AppData\Local\Temp\karma-40710999
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=C:\Users\[...]\AppData\Local\Temp\karma-40710999 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate ht
tp://localhost:9876/?id=40710999
DEBUG [launcher]: Process Chrome exited with code 0
ERROR [launcher]: Cannot start Chrome

DEBUG [temp-dir]: Cleaning temp dir C:\Users\[...]\AppData\Local\Temp\karma-40710999
INFO [launcher]: Trying to start Chrome again (2/2).
DEBUG [launcher]: Restarting Chrome
DEBUG [temp-dir]: Creating temp dir at C:\Users\[...]\AppData\Local\Temp\karma-40710999
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=C:\Users\[...]\AppData\Local\Temp\karma-40710999 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate ht
tp://localhost:9876/?id=40710999
DEBUG [framework.browserify]: bundling
DEBUG [launcher]: Process Chrome exited with code 0
ERROR [launcher]: Cannot start Chrome

DEBUG [temp-dir]: Cleaning temp dir C:\Users\[...]\AppData\Local\Temp\karma-40710999
DEBUG [web-server]: serving: D:\[...]\node_modules\karma\static/client.html
DEBUG [web-server]: serving (cached): D:\[...]\node_modules\karma\static/client.html
ERROR [launcher]: Chrome failed 2 times (cannot start). Giving up.
DEBUG [web-server]: serving (cached): D:\[...]\node_modules\karma\static/client.html
DEBUG [web-server]: serving: D:\[...]\node_modules\karma\static/karma.js
DEBUG [web-server]: serving (cached): D:\[...]\node_modules\karma\static/karma.js
DEBUG [web-server]: serving (cached): D:\[...]\node_modules\karma\static/karma.js
[...]
DEBUG [web-server]: upgrade /socket.io/1/websocket/hZrbHj-2BzuPr_YNkUmW
DEBUG [karma]: A browser has connected on socket hZrbHj-2BzuPr_YNkUmW
DEBUG [web-server]: upgrade /socket.io/1/websocket/9Nh06gkCmfm7Ag4dkUmX
DEBUG [karma]: A browser has connected on socket 9Nh06gkCmfm7Ag4dkUmX
DEBUG [web-server]: upgrade /socket.io/1/websocket/JFZ5G4UQX3ciOHOnkUmY
DEBUG [karma]: A browser has connected on socket JFZ5G4UQX3ciOHOnkUmY
INFO [Chrome 39.0.2171 (Windows 8.1)]: Connected on socket hZrbHj-2BzuPr_YNkUmW with id 40710999
DEBUG [launcher]: Chrome (id 40710999) captured in 4.242 secs
DEBUG [Chrome 39.0.2171 (Windows 8.1)]: New connection 9Nh06gkCmfm7Ag4dkUmX (already have hZrbHj-2BzuPr_YNkUmW)
DEBUG [Chrome 39.0.2171 (Windows 8.1)]: New connection JFZ5G4UQX3ciOHOnkUmY (already have hZrbHj-2BzuPr_YNkUmW, 9Nh06gkCmfm7Ag4dkUmX)
DEBUG [watcher]: Add file "D:/fab3d-lowfab/testClient/stlImportTest.coffee" ignored. Already in the list.
WARN [Chrome 39.0.2171 (Windows 8.1)]: Disconnected (1 times), because no message in 10000 ms.
ERROR [karma]: [TypeError: Cannot call method 'map' of undefined]
TypeError: Cannot call method 'map' of undefined
  at [object Object]._render (D:\[...]\node_modules\karma\lib\reporters\progress.js:56:27)
  at [object Object]._refresh (D:\[...]\node_modules\karma\lib\reporters\progress.js:60:34)
  at [object Object].onBrowserComplete (D:\[...]\node_modules\karma\lib\reporters\progress.js:19:21)
  at [object Object].<anonymous> (D:\[...]\node_modules\karma\lib\events.js:15:22)
  at [object Object].emit (events.js:117:20)
  at [object Object]._onTimeout (D:\[...]\node_modules\karma\lib\browser.js:53:15)
  at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

DEBUG [launcher]: Disconnecting all browsers
DEBUG [framework.browserify]: cleaning up
Sam-Davis commented 9 years ago

I am having the same issue

ncelerier commented 9 years ago

Hello,

I've the same problem, except that my configuration is a bit different:

    "karma" : "0.12.31",
    "karma-jasmine" : "0.3.5",
    "karma-chrome-launcher" : "0.1.7",
    "karma-firefox-launcher": "0.1.4",
    "jasmine-core" : "2.2.0",

Note that :

Has anyone of you found a solution to this problem ?

Tell me if I can give you more information.

Thank you.

MarkusPint commented 9 years ago

+1 I have the same problem

andrevinsky commented 9 years ago

The /?id=1231231 part makes the browser freeze. If you manually remove it, it'll get connected. I don't know why.

cwmrowe commented 9 years ago

I'm also getting this problem ever since our IT department changed something in Chrome. Has anyone found a solution?

parris commented 9 years ago

Yea, I'm getting this as well (I think). I found that restarting my computer makes the non-debug mode work better.

TheSavior commented 9 years ago

This has been a problem for us as well recently running with Chrome in Jenkins

maggialejandro commented 9 years ago

Same issue than @ncelerier

OS: WIndow 7 32bits

same dependencies

paulm-jones commented 9 years ago

Same issue, fewer dependencies (no Firefox launcher)

fi0rini commented 8 years ago

Same exact issue - has this been fixed yet?

kareemaly commented 8 years ago

I had the same issue & I didn't have the choice to change to other launcher. So to fix this without changing chrome launcher, I had to set CHROME_BIN ENV to firefox binary!

ghost commented 8 years ago

I am facing the same issue. Is it planned to be fixed?

horvatic commented 8 years ago

Same issue... Here is my package.config: { "devDependencies": { "jasmine-core": "^2.4.1", "karma": "^1.1.1", "karma-chrome-launcher": "^1.0.1", "karma-jasmine": "^1.0.2" } }

Here is my console output: LearningAng> karma start karma.conf.js 08 07 2016 09:03:30.680:WARN [karma]: No captured browser, open http://localhost :9876/ 08 07 2016 09:03:30.696:INFO [karma]: Karma v1.1.1 server started at http://loca lhost:9876/ 08 07 2016 09:03:30.696:INFO [launcher]: Launching browser Chrome with unlimited concurrency 08 07 2016 09:03:30.696:INFO [launcher]: Starting browser Chrome 08 07 2016 09:03:30.954:ERROR [launcher]: Cannot start Chrome

08 07 2016 09:03:30.962:INFO [launcher]: Trying to start Chrome again (1/2). 08 07 2016 09:03:31.281:ERROR [launcher]: Cannot start Chrome

08 07 2016 09:03:31.285:INFO [launcher]: Trying to start Chrome again (2/2). 08 07 2016 09:03:31.667:ERROR [launcher]: Cannot start Chrome

08 07 2016 09:03:31.675:ERROR [launcher]: Chrome failed 2 times (cannot start). Giving up. 08 07 2016 09:03:31.771:INFO [Chrome 51.0.2704 (Windows 7 0.0.0)]: Connected on socket /#8PR6KiLHarkZSz3AAAAA with id 19866284

Here is my output when closing the tabs

LearningAng> karma start karma.conf.js 08 07 2016 09:04:52.698:WARN [karma]: No captured browser, open http://localhost :9876/ 08 07 2016 09:04:52.698:INFO [karma]: Karma v1.1.1 server started at http://loca lhost:9876/ 08 07 2016 09:04:52.698:INFO [launcher]: Launching browser Chrome with unlimited concurrency 08 07 2016 09:04:52.729:INFO [launcher]: Starting browser Chrome 08 07 2016 09:04:53.007:ERROR [launcher]: Cannot start Chrome

08 07 2016 09:04:53.016:INFO [launcher]: Trying to start Chrome again (1/2). 08 07 2016 09:04:53.353:ERROR [launcher]: Cannot start Chrome

08 07 2016 09:04:53.362:INFO [launcher]: Trying to start Chrome again (2/2). 08 07 2016 09:04:53.818:ERROR [launcher]: Cannot start Chrome

08 07 2016 09:04:53.836:ERROR [launcher]: Chrome failed 2 times (cannot start). Giving up. 08 07 2016 09:04:53.885:INFO [Chrome 51.0.2704 (Windows 7 0.0.0)]: Connected on socket /#S1mJTJaQzbRhs0KDAAAA with id 88919744 08 07 2016 09:04:56.603:WARN [Chrome 51.0.2704 (Windows 7 0.0.0)]: Disconnected (1 times) 08 07 2016 09:04:56.610:ERROR [karma]: [TypeError: Cannot read property 'map' of undefined] TypeError: Cannot read property 'map' of undefined at _render (c:\ShawnDocs\Apprenticeships\week13\Test Envoriment\LearningAngT DD\usingNode\CalculatorKarma\node_modules\karma\lib\reporters\progress.js:53:26)

at writeCommonMsg (c:\ShawnDocs\Apprenticeships\week13\Test Envoriment\Learn

ingAngTDD\usingNode\CalculatorKarma\node_modules\karma\lib\reporters\progress.js :9:44) at onBrowserError (c:\ShawnDocs\Apprenticeships\week13\Test Envoriment\Learn ingAngTDD\usingNode\CalculatorKarma\node_modules\karma\lib\reporters\base.js:63: 10) at null. (c:\ShawnDocs\Apprenticeships\week13\Test Envoriment\Lea rningAngTDD\usingNode\CalculatorKarma\node_modules\karma\lib\events.js:13:22) at emitTwo (events.js:92:20) at emit (events.js:172:7) at disconnect (c:\ShawnDocs\Apprenticeships\week13\Test Envoriment\LearningA ngTDD\usingNode\CalculatorKarma\node_modules\karma\lib\browser.js:40:13) at onDisconnect (c:\ShawnDocs\Apprenticeships\week13\Test Envoriment\Learnin gAngTDD\usingNode\CalculatorKarma\node_modules\karma\lib\browser.js:157:7) at Socket. (c:\ShawnDocs\Apprenticeships\week13\Test Envoriment\L earningAngTDD\usingNode\CalculatorKarma\node_modules\karma\lib\events.js:13:22) at emitOne (events.js:77:13) at Socket.emit (events.js:169:7) at Socket.emit (c:\ShawnDocs\Apprenticeships\week13\Test Envoriment\Learning AngTDD\usingNode\CalculatorKarma\node_modules\karma\node_modules\socket.io\lib\s ocket.js:128:10) at Socket.onclose (c:\ShawnDocs\Apprenticeships\week13\Test Envoriment\Learn ingAngTDD\usingNode\CalculatorKarma\node_modules\karma\node_modules\socket.io\li b\socket.js:425:8) at Client.onclose (c:\ShawnDocs\Apprenticeships\week13\Test Envoriment\Learn ingAngTDD\usingNode\CalculatorKarma\node_modules\karma\node_modules\socket.io\li b\client.js:232:24) at emitTwo (events.js:92:20) at Socket.emit (events.js:172:7)

LearningAng>

leoselig commented 7 years ago

We also ran into this when using https://github.com/mark-adams/docker-chromium-xvfb and spawning more than one karma process in parallel]

Edit: We just see a ERROR [launcher]: Chrome crashed. (typically after INFO [launcher]: Starting browser Chrome)

raghuramrangaraju commented 7 years ago

In the configuration file for your project (e.g. karma.config.js), check if you have the plugins listed plugins : [ 'karma-junit-reporter', 'karma-chrome-launcher', 'karma-firefox-launcher', 'karma-opera-launcher', 'karma-ie-launcher', 'karma-jasmine' ],

wouterpouls commented 6 years ago

Somebody who found a solution for this issue?

johnjbarton commented 6 years ago

Has anyone seen this on any platform other than Windows 7?

Just to set expectations: there are no steps to reproduce this issue so someone who has the problem is going to have to dig in and sort it out. Anyone who has this happen every time has a good chance to track it down. For examples: Add logging to karma-chrome-launcher; log the exact commands it issues; try those commands directly.

spinningarrow commented 6 years ago

I’m still seeing this issue on Windows 7. Any pointers on where I should start digging/adding logs?

pssam commented 5 years ago

I have the same issue. I've figured out that the reason is "--user-data-dir" flag in command chrome.exe --user-data-dir=C:\Users\SIARHE~1\AppData\Local\Temp\karma-96883176 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-background-timer-throttling --disable-renderer-backgrounding --disable-device-discovery-notifications http://localhost:9876/?id=96883176 Could anyone help me with further steps?

johnjbarton commented 5 years ago

Completely separately I've found that chrome misbehaves if the user-data-dir is not writable. Maybe check that.

pssam commented 5 years ago

I've tried with other folders. It only works if I remove this flag. Moreover, a folder for user data is created successfully by Chrome.