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

Disconnected, because no message in 10000 ms. #1413

Closed
byrondover opened this issue Aug 15, 2017 · 8 comments
Closed

Disconnected, because no message in 10000 ms. #1413

byrondover opened this issue Aug 15, 2017 · 8 comments

Comments

@byrondover
Copy link

Jasmine 2.7.0 fails to launch headless Chrome (--no-sandbox) on Shippable node_js 7.4.0. As a workaround, reverting to 2.6.4 resolves the issue.

Logs copied below, for reference.

$ xvfb-run --server-args="-ac" yarn test

yarn run v0.24.5
$ ng test -cc -sr --progress false --reporters coverage-istanbul,junit,spec 

15 08 2017 04:11:53.934:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
15 08 2017 04:11:53.937:INFO [launcher]: Launching browser Chrome --no-sandbox with unlimited concurrency
15 08 2017 04:11:53.943:INFO [launcher]: Starting browser Chrome
15 08 2017 04:12:36.062:INFO [Chrome 58.0.3029 (Linux 0.0.0)]: Connected on socket UAp0xuAyNMjtm4f6AAAA with id 80303544
15 08 2017 04:12:46.065:WARN [Chrome 58.0.3029 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.
Chrome 58.0.3029 (Linux 0.0.0) ERROR
  Disconnected, because no message in 10000 ms.
Chrome 58.0.3029 (Linux 0.0.0) ERROR
  Disconnected, because no message in 10000 ms.
Chrome 58.0.3029 (Linux 0.0.0) ERROR
  Disconnected, because no message in 10000 ms.

Chrome 58.0.3029 (Linux 0.0.0): Executed 0 of 0 DISCONNECTED (10.004 secs / 0 secs)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Please let me know if I can provide any further context or logs. 🙂 If you are already aware, please feel free to close this issue.

@slackersoft
Copy link
Member

Jasmine doesn't launch a browser, it should be karma that's doing that for you. Check over here: https://github.com/karma-runner/karma

Hope this helps. Thanks for using Jasmine!

@byrondover
Copy link
Author

Hrmm ... I wonder why changing the Jasmine package version in isolation causes this behavior, but I shall follow up with the Karma team.

Thanks, Gregg!

@johncrim
Copy link

johncrim commented Oct 4, 2017

See angular/angular-cli#7281

@cport1
Copy link

cport1 commented Oct 4, 2017

Add this to your Karma.conf:

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

@JSONRice
Copy link

JSONRice commented Oct 9, 2017

@byrondover I don't think the Karma team will be able to assist you much further on this issue. I was having the same problem and following the advice of @cport1 resolved my issue, but he set his timeout to nearly four minutes. I found that 30 seconds was more than enough time. Might bump it up to 60 seconds. Running this all on Jenkins daily so I'm sure I'll get an email if this happens again. For development I am running off of an older Macbook Pro 13" Mac OS X Sierra.

@byrondover
Copy link
Author

Thanks, gents! Appreciate the advice. 🙂

@dlarr
Copy link

dlarr commented Feb 1, 2018

Thanks @cport1 - This worked like a charm.

4Lergo pushed a commit to lergo/lergo-ui that referenced this issue May 31, 2018
stainii pushed a commit to UnionVMS/UVMS-Frontend that referenced this issue Jul 6, 2018
HSchwichtenberg added a commit to HSchwichtenberg/MiracleListAngular that referenced this issue Oct 12, 2018
@ghost
Copy link

ghost commented Oct 23, 2018

Using @swetapatil1 answer, I am now able to finally work!

Using the flags from this:

/home/jenkins/workspace/node_modules/puppeteer/.local-chromium/linux-579032/chrome-linux/chrome --user-data-dir=/tmp/karma-62557134 --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 --disable-gpu --headless --no-sandbox --remote-debugging-port=9222 http://localhost:9876/?id=62557134

You may also want to try the same command but without --headless to see what happens. (Note that the URL will probably be invalid.)

I was finally able to forge a working karma.conf.json (for headless ubuntu+chrome):

karma.conf.json

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],
    client:{
      clearContext: false, // leave Jasmine Spec Runner output visible in browser
      jasmine: {
        random: false
      }
    },
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, 'coverage'),
      reports: [ 'html', 'lcovonly' ],
      fixWebpackSourcePaths: true,
      thresholds: {
        statements: 85,
        lines: 85,
        branches: 55,
        functions: 80
      }
    },
    captureTimeout: 210000,
    browserDisconnectTolerance: 3,
    browserDisconnectTimeout : 210000,
    browserNoActivityTimeout : 210000,
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_DEBUG,
    autoWatch: true,
    browsers: ['ChromeHeadlessNoSandbox'],
    customLaunchers: {
      ChromeHeadlessNoSandbox: {
        base: 'ChromeHeadless',
        flags: [
                '--no-sandbox',
                '--disable-gpu',
                '--enable-logging',
                '--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',
                '--remote-debugging-port=9222',
                '--disable-web-security'
        ]
      }
    },
    singleRun: true
  });
};

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

6 participants