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

Having problems running karma with jenkins in chrome #73

Open
TerribleDev opened this issue Jul 22, 2016 · 44 comments
Open

Having problems running karma with jenkins in chrome #73

TerribleDev opened this issue Jul 22, 2016 · 44 comments

Comments

@TerribleDev
Copy link

TerribleDev commented Jul 22, 2016

After chrome updated today it seems our builds no longer work. interactive shells seem to work, just not in jenkins :(

chrome Version 52.0.2743.82 m
OS: Windows Server 2012 r2

�[4mRunning "karma:continuous" (karma) task�[24m
�[32mINFO [karma]: �[39mKarma v0.12.31 server started at http://localhost:9876/
�[32mINFO [launcher]: �[39mStarting browser Chrome
�[32mINFO [framework.browserify]: �[39m2640391 bytes written (24.08 seconds)
�[32mINFO [framework.browserify]: �[39mbundle built
�[33mWARN [launcher]: �[39mChrome have not captured in 60000 ms, killing.
�[32mINFO [launcher]: �[39mTrying to start Chrome again (1/2).
�[33mWARN [launcher]: �[39mChrome have not captured in 60000 ms, killing.
�[32mINFO [launcher]: �[39mTrying to start Chrome again (2/2).
�[33mWARN [launcher]: �[39mChrome have not captured in 60000 ms, killing.
�[31mERROR [launcher]: �[39mChrome failed 2 times (timeout). Giving up.
@TerribleDev TerribleDev changed the title Having problems running karma with jenkins in chrome Version 52.0.2743.82 m Having problems running karma with jenkins in chrome Jul 22, 2016
@TerribleDev
Copy link
Author

I don't have the same issues with the firefox launcher so this is less of a concern. Most of the dev's on my team use chrome anyways so its pretty much auto tested.

Thanks

@cjwainwright
Copy link

Same issue here, launching chrome 52 when running karma tests in teamcity. The problem doesn't seem to arise if running interactively.

@TerribleDev
Copy link
Author

For us it worked in versions prior to 52

@adriaanthomas
Copy link

adriaanthomas commented Jul 26, 2016

Running into the same issue.

Without any changes in any JS modules, this appears to stop working after Chrome upgraded from 51.0.2704.103 to 52.0.2743.82.

Some time ago our e2e tests using a selenium server on Windows started to fail due to this issue. We have yet to validate if that still happens, but it might be related?

We're not using Jenkins here (Microsoft Visual Studio Team Services) but a similar setup I guess. The build agent runs as a Windows Service in session 0, spawns a build process (Gulp in our case) which starts Chrome using this plugin.

@edgahan
Copy link

edgahan commented Aug 1, 2016

I was running into the same issue with both e2e protractor tests and Karma unit tests. Windows jenkins specifically (running manually in cmd was working fine).

The (temp) fix was the same for both:

In karma.conf:

    browsers: ['ChromeNoSandbox'],

    customLaunchers: {
      ChromeNoSandbox: {
        base: 'Chrome',
        flags: ['--no-sandbox']
      }
    }

In protractor.conf

    browserName: 'chrome',
    chromeOptions: {
      args: ['--no-sandbox']
    }
  }

"karma-chrome-launcher": "^1.0.1", and "protractor": "4.0.0",

@DavideDaniel
Copy link

DavideDaniel commented Aug 1, 2016

We tried edgahan's temp fix but it did not work for us. The issues started around upgrading to karma-chrome-launcher: 1.0.1 and Chrome 51 upgrading to 52. It's unclear what's the issue here since our Jenkins machine spits out:

12:49:29      [exec] [1] START:
12:49:29      [exec] [0] npm run lint exited with code 0
12:49:29      [exec] [1] 01 08 2016 12:49:22.360:INFO [karma]: Karma v1.1.1 server started at http://localhost:9876/
12:49:29      [exec] [1] 01 08 2016 12:49:22.362:INFO [launcher]: Launching browsers ChromeNoSandbox, ElectronNoSandbox with unlimited concurrency
12:49:29      [exec] [1] 01 08 2016 12:49:22.375:INFO [launcher]: Starting browser Chrome
12:49:29      [exec] [1] 01 08 2016 12:49:22.392:INFO [launcher]: Starting browser electron
12:49:29      [exec] [1] 01 08 2016 12:49:25.979:INFO [Chrome 52.0.2743 (Windows 8.1 0.0.0)]: Connected on socket /#80VNe5WGo53GZH1OAAAA with id 40667921
12:49:29      [exec] [1] Chrome 52.0.2743 (Windows 8.1 0.0.0) ERROR
12:49:29      [exec] [1]   Script error.
12:49:29      [exec] [1] 01 08 2016 12:49:27.506:INFO [Chrome 47.0.2526 (Windows 8.1 0.0.0)]: Connected on socket /#q_QvLGea2t_M6n-fAAAB with id 49218709
12:49:29      [exec] [1] Chrome 47.0.2526 (Windows 8.1 0.0.0) ERROR
12:49:29      [exec] [1]   Script error.
12:49:29      [exec] [1] 
12:49:29      [exec] [1] Finished in 2.826 secs / 0 secs
12:49:29      [exec] [1] 
12:49:29      [exec] [1] 
12:49:29      [exec] [1] SUMMARY:
12:49:29      [exec] [1] √ 0 tests completed
12:49:29      [exec] [1] babel-node node_modules/karma/bin/karma start exited with code 1
12:49:29      [exec] 

Next up, will be checking if reverting to older launcher version helps.
UPDATE - no fix from reverting karma-launcher versions - likely this is related to: https://bugs.chromium.org/p/chromium/issues/detail?id=615396

@peabnuts123
Copy link

+1, started getting the same issue across all my projects with the following configuration:

Windows Server 2012 R2 Standard

Chrome 52.0.2743.82 m
karma 0.13.22
karma-chrome-launcher 1.0.1

Not using Jenkins, using TFS on Windows Server. Seems to be caused by the fact that Chrome is version 52.

edgahan's fix worked for us.

Can anyone confirm DavideDaniel's claim that this is a bug in Chromium?

@cjwainwright
Copy link

@edgahan's temporary fix seems to work here too, thanks.

@cjeffers
Copy link

cjeffers commented Aug 5, 2016

Same issue for me, but only experienced after the update to 52.0.2743.116. Can confirm --no-sandbox fixed issue for both Karma and Protractor tests.

@wilhen01
Copy link

wilhen01 commented Aug 9, 2016

Experiencing this with Jenkins / Windows slave, Chrome 52, karma. @edgahan's fix worked for us!

@s-kavanagh
Copy link

Thanks @edgahan - your fix helped us on TeamCity too after Chrome updated to 52

KorinaGraber pushed a commit to RenovoSolutions/Gulp-Typescript-Utilities that referenced this issue Aug 9, 2016
Seems to resolve an issue with running on the build server.
karma-runner/karma-chrome-launcher#73 (comment)
@davidpricedev
Copy link

Another option to fix this is to install v51.* on the build machine (after uninstalling 52.0.2743.116). It can be a bear to find usable, older versions of chrome though.

@rbutcher
Copy link

rbutcher commented Aug 9, 2016

Happens with Bamboo / Windows 10 using Chrome 52. @edgahan fix does not work.

@Toyonut
Copy link

Toyonut commented Aug 9, 2016

Cheers @edgahan, fix worked for us. Just like @peabnuts123, we are running:
*Server 2012 R2
*Chrome 52
*Karma-Chrome-Launcher 1.0.1.

This was failing in Teamcity and VSTS when running karma.

@crawlregister
Copy link

@edgahan's fix not worked for us. We are running:

Mac OSX 10.11.6
Chrome 52.0.2743.116
Karma-Chrome-Launcher 1.0.1 and 2.0.0

@agccheung
Copy link

Was experiencing this problem with
Chrome 52.0.x
Karma-Chrome-Launcher 1.0.1 and 2.0.0

Chrome update as of this morning to 53.0.2785 and seems to have resolved it. Anyone else confirm?

@cjwainwright
Copy link

@agccheung Yep. Can confirm that it is now working for us in Chrome 53.0.2785

@peabnuts123
Copy link

53.0.2785 also working on our server

@jessicalc
Copy link

It's breaking now, locally, for me since my Chrome updated to 53.0.2785.

Anyone else having this issue? It was breaking on a Jenkins build since yesterday till we downgraded back to 52 today.

@binarious
Copy link

binarious commented Sep 15, 2016

Same problem for me with the following setup:

browsers: [
  'ChromeNoSandbox'
],

customLaunchers: {
  ChromeNoSandbox: {
    base: 'Chrome',
    flags: ['--no-sandbox']
  }
},

karma-chrome-launcher: 2.0.0
karma: 1.3.0
chrome: 53.0.2785.116
os: CentOS 7

@latobibor
Copy link

latobibor commented Oct 20, 2016

Having the same problem (but without Jenkins)!
@edgahan 's fix worked for me. But it's not a fix for us as it runs smoothly on other people's computer.

karma-chrome-launcher: 2.0.0
karma: 1.3.0
os: win 10 x64
chrome: 54.0.2840.59 m (64-bit)
IDE I was running the tests from: Webstorm 2016.2.4.

@lucastheisen
Copy link

lucastheisen commented Jun 1, 2017

I am attempting to run in bamboo:

karma-chrome-launcher: 2.1.1
karma: 1.7.0
os: RHEL 6.9 (using xvfb-run to run headless)
chrome: Chromium 58.0.3029.96 (using export CHROME_BIN="chromium-browser")

Same problem:

01 06 2017 18:28:34.850:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
01 06 2017 18:28:34.853:INFO [launcher]: Launching browser ChromeNoSandbox with unlimited concurrency
01 06 2017 18:28:35.039:INFO [launcher]: Starting browser Chrome
01 06 2017 18:29:35.090:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
01 06 2017 18:29:35.578:INFO [launcher]: Trying to start Chrome again (1/2).

@cmacdonnacha
Copy link

I'm seeing the same issue. Did you get anywhere with this @lucastheisen ?

@lucastheisen
Copy link

@cmacdonnacha , I heard that chrome 59 introduced headless support but have not yet had a chance to test that out... When I get a chance i will report back...

@amureki
Copy link

amureki commented Aug 2, 2017

@lucastheisen I'm running chrome headless version with karma on travis.
It still have this problem with failing launch.

@cmacdonnacha
Copy link

We switched to chrome headless. Chrome 60 supports chrome headless on windows.

@michaelcm
Copy link

michaelcm commented Sep 8, 2017

Hello, I'm running into this as well now... after upgrading packages:

-    "karma": "~1.5.0",
-    "karma-chrome-launcher": "~2.0.0",
+    "karma": "~1.7.1",
+    "karma-chrome-launcher": "~2.2.0",

Chrome 60 is installed on Windows 7 64-bit. Tried the fix mentioned in this ticket, but it still cannot connect with --no-sandbox.

Did anyone have a work around for this?

@RobotnickIsrael
Copy link

I'm having this as well.
It does not capture on first attempt, but does in second attept. This makes the Jenkins CI cycle be very slow. Any fix for this? (Same error on both Chrome and ChromeHeadless)

"karma": "1.7.0",
"karma-chrome-launcher": "2.1.1",
Chrome 60.0.3112.90 (Official Build) (64-bit)

@JoosjeBoon
Copy link

Having the same issue.
Windows 7
Chrome 61
Karma 1.7.1
Karma-chrome-launcher 2.2.0

Works fine on Linux.

@cport1
Copy link

cport1 commented Sep 26, 2017

Try adding this to your Karma.conf.js


captureTimeout: 210000,
browserDisconnectTolerance: 3, 
browserDisconnectTimeout : 210000,
browserNoActivityTimeout : 210000,

@chrismwendt
Copy link

You can get the exact shell command that Karma is running by adding a log statement to ./node_modules/karma/lib/launchers/process.js. See my write-up here: karma-runner/karma#1206 (comment)

@JoosjeBoon
Copy link

Thanks for the info, will try it out and share my findings.

@jotka
Copy link

jotka commented Oct 24, 2017

hi dear all. Has this been somehow fixed? I have the same on the lastest Chrome / Debian.
"Chrome have not captured in 60000 ms, killing." when running a job on Jenkins through docker container.

"karma": "1.7.1",
"karma-chrome-launcher": "2.2.0",

@Tenmak
Copy link

Tenmak commented Oct 30, 2017

@jotka Check this comment I gave on a related issue : karma-runner/karma#1206 (comment)

I'm using the same versions as yours, and I can run everything without any problem now.

@TristanMarion
Copy link

@Tenmak's solution worked for me, thanks a lot !

@vlodko
Copy link

vlodko commented Jun 15, 2018

this worked for me on build server:

// add this at the top of file
process.env.CHROME_BIN = require('puppeteer').executablePath();
....


    browsers: ['Chrome'],
    browserDisconnectTimeout: 10000,
    browserDisconnectTolerance: 3,
    browserNoActivityTimeout: 60000,
    flags: [
      '--disable-web-security',
      '--disable-gpu',
      '--no-sandbox'
    ]

@wbotelhos
Copy link

Thank you, @edgahan ! (:

@bigbasti
Copy link

I had the exact same issue with our jenkins and ChromeHeadless.

This solved it for me:
set a NO_PROXY env variable :
export NO_PROXY="localhost, 0.0.0.0/4201, 0.0.0.0/9876"

Source: karma-runner/karma#1206 (comment)

@joerattz
Copy link

@edgahan Just wanted to report that even as of this late date, edgahan's fix solved my problem of Chrome not opening on a Jenkins Windows server.

My client side unit tests via karma had been working fine in my Jenkins pipeline job. The pipeline job was very new though and had only been completely working for a couple days, but it definitely worked, including my client unit tests. Then, last Friday (3/22/2019) it broke with the same errors reported above ("Chrome failed 2 times (timeout). Giving up."). I tried edgahan's fix and the problem is resolved.

I, myself, hadn't changed anything with the server that would explain why it suddenly broke. Maybe Chrome downloaded an update? Maybe our network/security team changed something? Don't know.

Don't know the version of Chrome before now, but it's currently Version 73.0.3683.86 (Official Build) (64-bit) and says it's up to date.

Here are the current versions of my Karma packages:

karma@1.7.1
karma-chrome-launcher@2.2.0
karma-coverage-istanbul-reporter@2.0.4
karma-jasmine@1.1.2
karma-jasmine-html-reporter@0.2.2

Just wanted to report this currently solved the problem for me because when I read this thread, and how long ago this was a problem, I was skeptical that it would resolve the problem, but it did.

Thanks @edgahan !

@i-C-o-d-e-r
Copy link

I am facing the same issue with Karma and Chrome reported here with a Jenkins Agent/Slave on a Windows 7 (64-Bit) machine. The problem exists approx. since a week (I think it has something todo with a Chrome update). I had no hope that any of the proposed workaround would work for me. But after I read @joerattz update on this issue, I gave @edgahan 's workaround a try, and I can confirm that this solved my problem as well.

Thanks @joerattz and @edgahan !

karma@4.0.1
karma-chrome-launcher@2.2.0
chrome@73.0.3683.86

@RobMoloney
Copy link

To resolve the issue I added hostname: 'localhost', to my karma config.

The issue I had related to an invalid url.
When I ran karma on Jenkins with logLevel: config.LOG_DEGUG, I noticed that the url used by Karma was http://"192.169.1.110":9876. Double quotes were surrounding the ipaddress in the url. I'm not sure what causes this but forcing karma to use localhost fixed the problem.

@Yrkki
Copy link

Yrkki commented Jun 14, 2020

@Tenmak

@jotka Check this comment I gave on a related issue : karma-runner/karma#1206 (comment)

I'm using the same versions as yours, and I can run everything without any problem now.

Saved my life! :)

Thank you lots!

@geekamit8080
Copy link

Hi Team,

Today I solved this issue. We have a problem of extreme slowness with chrome browser with Jenkins. We executes selenium scripts on chromeBrowser in stateless mode and we experiencing extreme lag after recent chrome browser update.

Root cause:- We scrutinize the root cause of the problem and we get to know the focus of web driver instance is not set on the chrome browser under execution. If you execute it by eclipse locally you can figure it out easily. once the browser is open and your focus is on the browser all test-cases executes fast if you minimize the browser then you notice delay in the execution.

Here is the solution:-
You have to work on the driver instance for chrome. There is one class ChromeOptions which set's capabilities for driver instance which execute scripts on chrome. set driver.options.setHeadless(true); and excute your scripts problem gets resolved.

@av1v3k
Copy link

av1v3k commented Mar 10, 2021

@edgahan suggestion didn't help either.

Any alternate solutions ?

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