karma-chrome-launcher icon indicating copy to clipboard operation
karma-chrome-launcher copied to clipboard

karma crashes when chrome is already running

Open Steditor opened this issue 9 years ago • 21 comments

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

Steditor avatar Jan 07 '15 13:01 Steditor

I am having the same issue

Sam-Davis avatar Jan 19 '15 08:01 Sam-Davis

Hello,

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

  • Windows 7 64 bits, no administrator rights
  • Chrome 40.0.2214.91 (Liberkey version)
  • Firefox 35 (Liberkey version)
  • I'm using these dependencies :
    "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 :

  • Even if Chrome is not already launched, Chrome will start and open the three tabs.
  • It is working properly when I use Firefox instead of Chrome in the karma browsers variable.
  • If I choose not to launch browsers when Karma start, and that I open Chrome and go to http://localhost:9876 manually, everything works properly.

Has anyone of you found a solution to this problem ?

Tell me if I can give you more information.

Thank you.

ncelerier avatar Mar 02 '15 13:03 ncelerier

+1 I have the same problem

MarkusPint avatar Mar 06 '15 16:03 MarkusPint

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

andrevinsky avatar Apr 08 '15 21:04 andrevinsky

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

cwmrowe avatar May 14 '15 14:05 cwmrowe

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

parris avatar Jun 23 '15 18:06 parris

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

TheSavior avatar Jul 02 '15 21:07 TheSavior

Same issue than @ncelerier

OS: WIndow 7 32bits

same dependencies

maggialejandro avatar Jul 23 '15 19:07 maggialejandro

Same issue, fewer dependencies (no Firefox launcher)

paulm-jones avatar Jul 31 '15 08:07 paulm-jones

Same exact issue - has this been fixed yet?

fi0rini avatar Nov 04 '15 22:11 fi0rini

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!

kareemaly avatar Dec 07 '15 08:12 kareemaly

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

ghost avatar Feb 10 '16 21:02 ghost

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>

horvatic avatar Jul 08 '16 14:07 horvatic

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)

leoselig avatar Jan 17 '17 11:01 leoselig

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' ],

raghuramrangaraju avatar Aug 02 '17 20:08 raghuramrangaraju

Somebody who found a solution for this issue?

wouterpouls avatar Nov 02 '17 15:11 wouterpouls

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.

johnjbarton avatar Nov 02 '17 16:11 johnjbarton

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

spinningarrow avatar Dec 18 '17 08:12 spinningarrow

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?

pssam avatar Feb 06 '19 15:02 pssam

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

johnjbarton avatar Feb 06 '19 16:02 johnjbarton

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.

pssam avatar Feb 06 '19 16:02 pssam