question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ChromeHeadless failed 2 times (timeout).

See original GitHub issue

karma.conf.js

// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const process = require('process');
process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular/cli'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular/cli/plugins/karma')
    ],
    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    coverageIstanbulReporter: {
      reports: [ 'html', 'lcovonly' ],
      fixWebpackSourcePaths: true
    },
    angularCli: {
      environment: 'dev'
    },
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome', 'ChromeHeadless', 'MyHeadlessChrome'],
    customLaunchers: {
      MyHeadlessChrome: {
        base: 'ChromeHeadless',
        flags: ['--disable-translate', '--disable-extensions', '--remote-debugging-port=9223']
      }
    },
    singleRun: false
  });
};

C:\Users\user\Desktop\dev\ros-advance-report\advanced-report-ui>npm run test

> advanced-report-ui@0.0.0 test C:\Users\user\Desktop\dev\ros-advance-report\advanced-report-ui
> ng test --single-run true --watch false

 10% building modules 1/1 modules 0 active15 05 2018 12:46:44.946:INFO [karma]: Karma v2.0.0 server started at http://0.0.0.0:9876/
15 05 2018 12:46:44.958:INFO [launcher]: Launching browsers Chrome, ChromeHeadless, MyHeadlessChrome with unlimited concurrency
15 05 2018 12:46:44.991:INFO [launcher]: Starting browser Chrome
15 05 2018 12:46:45.023:INFO [launcher]: Starting browser ChromeHeadless
15 05 2018 12:46:45.044:INFO [launcher]: Starting browser ChromeHeadless                                                                    15 05 2018 12:47:45.004:WARN [launcher]: C
hrome have not captured in 60000 ms, killing.
15 05 2018 12:47:45.035:WARN [launcher]: ChromeHeadless have not captured in 60000 ms, killing.
15 05 2018 12:47:45.051:WARN [launcher]: ChromeHeadless have not captured in 60000 ms, killing.
15 05 2018 12:47:45.136:INFO [launcher]: Trying to start ChromeHeadless again (1/2).
15 05 2018 12:47:47.010:WARN [launcher]: Chrome was not killed in 2000 ms, sending SIGKILL.
15 05 2018 12:47:47.042:WARN [launcher]: ChromeHeadless was not killed in 2000 ms, sending SIGKILL.
15 05 2018 12:47:49.014:WARN [launcher]: Chrome was not killed by SIGKILL in 2000 ms, continuing.
15 05 2018 12:47:49.046:WARN [launcher]: ChromeHeadless was not killed by SIGKILL in 2000 ms, continuing.
15 05 2018 12:47:52.278:INFO [launcher]: Trying to start Chrome again (1/2).
15 05 2018 12:47:52.282:WARN [temp-dir]: Failed to create a temp dir at C:\Users\user\AppData\Local\Temp\karma-45756352
15 05 2018 12:47:52.633:INFO [launcher]: Trying to start ChromeHeadless again (1/2).
15 05 2018 12:47:52.640:WARN [temp-dir]: Failed to create a temp dir at C:\Users\user\AppData\Local\Temp\karma-98510066
15 05 2018 12:48:16.924:ERROR [launcher]: Cannot start Chrome
        [5048:772:0515/124753.012:ERROR:install_util.cc(589)] Unable to create registry key HKLM\SOFTWARE\Policies\Chromium for reading result=2
[5048:772:0515/124753.172:ERROR:process_singleton_win.cc(410)] Lock file can not be created! Error code: 32
[5048:772:0515/124753.172:ERROR:chrome_browser_main.cc(1698)] Failed to create a ProcessSingleton for your profile directory. This means that running multiple instances would start m
ultiple browser processes rather than opening a new window in the existing process. Aborting now to avoid profile corruption.
[5048:8676:0515/124753.187:ERROR:browser_gpu_channel_host_factory.cc(119)] Failed to launch GPU process.

15 05 2018 12:48:16.928:ERROR [launcher]: Chrome stdout:
15 05 2018 12:48:16.931:ERROR [launcher]: Chrome stderr: [5048:772:0515/124753.012:ERROR:install_util.cc(589)] Unable to create registry key HKLM\SOFTWARE\Policies\Chromium for readi
ng result=2
[5048:772:0515/124753.172:ERROR:process_singleton_win.cc(410)] Lock file can not be created! Error code: 32
[5048:772:0515/124753.172:ERROR:chrome_browser_main.cc(1698)] Failed to create a ProcessSingleton for your profile directory. This means that running multiple instances would start m
ultiple browser processes rather than opening a new window in the existing process. Aborting now to avoid profile corruption.
[5048:8676:0515/124753.187:ERROR:browser_gpu_channel_host_factory.cc(119)] Failed to launch GPU process.

15 05 2018 12:48:20.291:INFO [launcher]: Trying to start Chrome again (2/2).
15 05 2018 12:48:20.296:WARN [temp-dir]: Failed to create a temp dir at C:\Users\user\AppData\Local\Temp\karma-45756352
15 05 2018 12:48:25.069:ERROR [launcher]: Cannot start ChromeHeadless
        [0515/124645.481:ERROR:gpu_process_transport_factory.cc(1012)] Lost UI shared context.

DevTools listening on ws://127.0.0.1:9222/devtools/browser/00f320ff-4ee1-4d79-934c-fdbdabc41e5a

15 05 2018 12:48:25.079:ERROR [launcher]: ChromeHeadless stdout:
15 05 2018 12:48:25.080:ERROR [launcher]: ChromeHeadless stderr: [0515/124753.549:ERROR:gpu_process_transport_factory.cc(1012)] Lost UI shared context.
[0515/124753.577:ERROR:tcp_socket_win.cc(346)] bind() returned an error: ������ ����������� ������ ���� ������������� ������ ������ (��������/������� �����/����). (0x2740)
[0515/124753.583:ERROR:tcp_socket_win.cc(346)] bind() returned an error: ������ ����������� ������ ���� ������������� ������ ������ (��������/������� �����/����). (0x2740)
[0515/124753.616:ERROR:devtools_http_handler.cc(292)] Cannot start http server for devtools. Stop devtools.
[0515/124758.822:ERROR:cache_util_win.cc(19)] Unable to move the cache: 5
[0515/124758.822:ERROR:cache_util.cc(134)] Unable to move cache folder C:\Users\user\AppData\Local\Temp\karma-98510066\Default\GPUCache to C:\Users\user\AppData\Local\Temp\karma-9851
0066\Default\old_GPUCache_000
[0515/124758.822:ERROR:disk_cache.cc(169)] Unable to create cache
[0515/124758.822:ERROR:shader_disk_cache.cc(600)] Shader Cache Creation failed: -2

15 05 2018 12:48:28.161:INFO [launcher]: Trying to start ChromeHeadless again (2/2).
15 05 2018 12:48:28.163:WARN [temp-dir]: Failed to create a temp dir at C:\Users\user\AppData\Local\Temp\karma-98510066
15 05 2018 12:48:45.140:WARN [launcher]: ChromeHeadless have not captured in 60000 ms, killing.
15 05 2018 12:48:47.142:WARN [launcher]: ChromeHeadless was not killed in 2000 ms, sending SIGKILL.
15 05 2018 12:48:49.144:WARN [launcher]: ChromeHeadless was not killed by SIGKILL in 2000 ms, continuing.
15 05 2018 12:48:52.397:INFO [launcher]: Trying to start ChromeHeadless again (2/2).
15 05 2018 12:48:52.431:WARN [temp-dir]: Failed to create a temp dir at C:\Users\user\AppData\Local\Temp\karma-90937908
15 05 2018 12:49:06.641:ERROR [launcher]: Cannot start Chrome
        [240:6396:0515/124645.308:ERROR:install_util.cc(589)] Unable to create registry key HKLM\SOFTWARE\Policies\Chromium for reading result=2
[10592:4304:0515/124817.799:ERROR:broker_win.cc(58)] Error reading broker pipe: Error (0x5) while retrieving error. (0x6D)

15 05 2018 12:49:06.650:ERROR [launcher]: Chrome stdout:
15 05 2018 12:49:06.652:ERROR [launcher]: Chrome stderr: [10592:4304:0515/124817.799:ERROR:broker_win.cc(58)] Error reading broker pipe: Error (0x5) while retrieving error. (0x6D)
[8480:4488:0515/124821.226:ERROR:install_util.cc(589)] Unable to create registry key HKLM\SOFTWARE\Policies\Chromium for reading result=2
[8480:1324:0515/124821.545:ERROR:backend_impl.cc(1423)] Unable to map Index file
[8480:1464:0515/124821.563:ERROR:disk_cache.cc(169)] Unable to create cache
[8480:1464:0515/124821.570:ERROR:shader_disk_cache.cc(600)] Shader Cache Creation failed: -2
[8480:10424:0515/124822.047:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: PRAGMA auto_vacuum
[8480:10424:0515/124822.057:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: PRAGMA journal_mode = TRUNCATE
[8480:1464:0515/124822.660:ERROR:cache_util_win.cc(19)] Unable to move the cache: 5
[8480:1464:0515/124822.660:ERROR:cache_util.cc(134)] Unable to move cache folder C:\Users\user\AppData\Local\Temp\karma-45756352\Default\GPUCache to C:\Users\user\AppData\Local\Temp\
karma-45756352\Default\old_GPUCache_000
[8480:1464:0515/124822.660:ERROR:disk_cache.cc(169)] Unable to create cache
[8480:1464:0515/124822.660:ERROR:shader_disk_cache.cc(600)] Shader Cache Creation failed: -2
[8480:10424:0515/124823.616:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: PRAGMA cache_size=32
[8480:10424:0515/124823.626:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: SELECT name FROM sqlite_master WHERE type=? AND name=? COLLATE NOC
ASE
[8480:10424:0515/124823.630:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: SELECT name FROM sqlite_master WHERE type=? AND name=? COLLATE NOC
ASE
[8480:10424:0515/124823.638:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: SELECT COUNT(*) FROM sqlite_master
[8480:10424:0515/124823.643:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: DROP TABLE IF EXISTS thumbnails
[8480:10424:0515/124823.647:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: DROP TABLE IF EXISTS temp_favicons
[8480:10424:0515/124823.652:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: DROP TABLE IF EXISTS temp_favicon_bitmaps
[8480:10424:0515/124823.657:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: DROP TABLE IF EXISTS temp_icon_mapping
[8480:10424:0515/124823.661:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: SELECT name FROM sqlite_master WHERE type=? AND name=? COLLATE NOC
ASE
[8480:10424:0515/124823.664:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, val
ue LONGVARCHAR)
[8480:10424:0515/124823.670:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: PRAGMA auto_vacuum
[8480:10424:0515/124823.674:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: PRAGMA journal_mode = TRUNCATE
[8480:10424:0515/124824.832:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: PRAGMA cache_size=32
[8480:10424:0515/124824.837:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: SELECT name FROM sqlite_master WHERE type=? AND name=? COLLATE NOC
ASE
[8480:10424:0515/124824.841:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: SELECT name FROM sqlite_master WHERE type=? AND name=? COLLATE NOC
ASE
[8480:10424:0515/124824.845:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: SELECT COUNT(*) FROM sqlite_master
[8480:10424:0515/124824.849:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: DROP TABLE IF EXISTS thumbnails
[8480:10424:0515/124824.853:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: DROP TABLE IF EXISTS temp_favicons
[8480:10424:0515/124824.856:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: DROP TABLE IF EXISTS temp_favicon_bitmaps
[8480:10424:0515/124824.860:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: DROP TABLE IF EXISTS temp_icon_mapping
[8480:10424:0515/124824.864:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: SELECT name FROM sqlite_master WHERE type=? AND name=? COLLATE NOC
ASE
[8480:10424:0515/124824.869:ERROR:connection.cc(1888)] Thumbnail sqlite error 5, errno 33: database is locked, sql: CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, val
ue LONGVARCHAR)

15 05 2018 12:49:07.848:ERROR [launcher]: Cannot start ChromeHeadless
        [0515/124745.594:ERROR:gpu_process_transport_factory.cc(1012)] Lost UI shared context.
[0515/124745.612:ERROR:tcp_socket_win.cc(346)] bind() returned an error: ������ ����������� ������ ���� ������������� ������ ������ (��������/������� �����/����). (0x2740)

DevTools listening on ws://[::1]:9222/devtools/browser/5514f291-28b4-4de0-8f3f-1293b30d4656

15 05 2018 12:49:07.864:ERROR [launcher]: ChromeHeadless stdout:
15 05 2018 12:49:07.867:ERROR [launcher]: ChromeHeadless stderr: [0515/124853.328:ERROR:gpu_process_transport_factory.cc(1012)] Lost UI shared context.
[0515/124853.345:ERROR:tcp_socket_win.cc(346)] bind() returned an error: ������ ����������� ������ ���� ������������� ������ ������ (��������/������� �����/����). (0x2740)
[0515/124853.346:ERROR:tcp_socket_win.cc(346)] bind() returned an error: ������ ����������� ������ ���� ������������� ������ ������ (��������/������� �����/����). (0x2740)
[0515/124853.347:ERROR:devtools_http_handler.cc(292)] Cannot start http server for devtools. Stop devtools.
[0515/124854.594:ERROR:cache_util_win.cc(19)] Unable to move the cache: 5
[0515/124854.594:ERROR:cache_util.cc(134)] Unable to move cache folder C:\Users\user\AppData\Local\Temp\karma-90937908\Default\GPUCache to C:\Users\user\AppData\Local\Temp\karma-9093
7908\Default\old_GPUCache_000
[0515/124854.594:ERROR:disk_cache.cc(169)] Unable to create cache
[0515/124854.594:ERROR:shader_disk_cache.cc(600)] Shader Cache Creation failed: -2

15 05 2018 12:49:10.125:ERROR [launcher]: Chrome failed 2 times (cannot start). Giving up.
15 05 2018 12:49:11.225:ERROR [launcher]: ChromeHeadless failed 2 times (cannot start). Giving up.
15 05 2018 12:49:28.163:WARN [launcher]: ChromeHeadless have not captured in 60000 ms, killing.
15 05 2018 12:49:30.168:WARN [launcher]: ChromeHeadless was not killed in 2000 ms, sending SIGKILL.
15 05 2018 12:49:32.172:WARN [launcher]: ChromeHeadless was not killed by SIGKILL in 2000 ms, continuing.
15 05 2018 12:49:35.330:ERROR [launcher]: ChromeHeadless failed 2 times (timeout). Giving up.
15 05 2018 12:49:37.049:ERROR [launcher]: ChromeHeadless failed 2 times (timeout). Giving up.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! advanced-report-ui@0.0.0 test: `ng test --single-run true --watch false`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the advanced-report-ui@0.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2018-05-15T09_49_38_957Z-debug.log


Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

15reactions
vlodkocommented, Jun 15, 2018

this worked for me on build server:

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

My issue got fixed after adding the below lines in .gitlab-ci.yml

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Karma - Chrome failed 2 times (cannot start). Giving up
ChromeHeadless - is for running tests without opening browser window ... captureTimeout - your browser may take some time to start.
Read more >
Jenkins + karma + Chrome not working after last update
ERROR [launcher ]: Chrome failed 2 times (timeout). Giving up. This does not appear to be related to anything in the known issues...
Read more >
Cannot start ChromeHeadless | Bitbucket Cloud - Jira
28 02 2019 10:41:17.408:ERROR [launcher]: ChromeHeadless failed 2 times (cannot start). Giving up. error Command failed with exit code 1.
Read more >
Fixing a Karma Issue With Chrome V93 | by Colton - Medium
The Karma failed to capture a full chrome for testing. Photo by Sarah Louise Kinsella on ... [launcher]: Trying to start Chrome again...
Read more >
karma-runner - Bountysource
[31mERROR [launcher]: [39mChrome failed 2 times (timeout). Giving up. ... ERROR [launcher]: Cannot load browser "ChromeHeadless": it is not registered! $ 0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found