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

FirefoxHeadless is not captured in containered GitHub action with node 16 #245

Open
MatthijsBurgh opened this issue Nov 1, 2022 · 5 comments

Comments

@MatthijsBurgh
Copy link

I am using karma in combination with grunt. Running the tests work fine on my machine(node 16), docker(locally, node 16) and containered GH action(node 14), but when running in containered GH action with node 16, it fails to start Firefox. It happens both in ubuntu 18 and 20.

The version of the Firefox apt package: 105.0+build2-0ubuntu0.20.04.1

The log (src):

unning "karma:test" (karma) task
01 11 2022 10:29:57.950:DEBUG [config]: Loading config /__w/roslibjs/roslibjs/test/karma.conf.js
01 11 2022 10:29:57.953:DEBUG [config]: autoWatch set to false, because of singleRun
01 11 2022 10:29:57.955:DEBUG [karma-server]: Final config Config {
  LOG_DISABLE: 'OFF',
  LOG_ERROR: 'ERROR',
  LOG_WARN: 'WARN',
  LOG_INFO: 'INFO',
  LOG_DEBUG: 'DEBUG',
  frameworks: [ 'mocha', 'chai' ],
  protocol: 'http:',
  port: 9876,
  listenAddress: '0.0.0.0',
  hostname: 'localhost',
  httpsServerConfig: {},
  basePath: '/__w/roslibjs/roslibjs/test',
  files: [
    Pattern {
      pattern: '/__w/roslibjs/roslibjs/node_modules/eventemitter2/lib/eventemitter2.js',
      served: true,
      included: true,
      watched: true,
      nocache: false,
      weight: [ 1, 0, 0, 0, 0, 0 ],
      type: undefined,
      isBinary: undefined,
      integrity: undefined
    },
    Pattern {
      pattern: '/__w/roslibjs/roslibjs/node_modules/cbor-js/cbor.js',
      served: true,
      included: true,
      watched: true,
      nocache: false,
      weight: [ 1, 0, 0, 0, 0, 0 ],
      type: undefined,
      isBinary: undefined,
      integrity: undefined
    },
    Pattern {
      pattern: '/__w/roslibjs/roslibjs/src/util/cborTypedArrayTags.js',
      served: true,
      included: true,
      watched: true,
      nocache: false,
      weight: [ 1, 0, 0, 0, 0, 0 ],
      type: undefined,
      isBinary: undefined,
      integrity: undefined
    },
    Pattern {
      pattern: '/__w/roslibjs/roslibjs/build/roslib.js',
      served: true,
      included: true,
      watched: true,
      nocache: false,
      weight: [ 1, 0, 0, 0, 0, 0 ],
      type: undefined,
      isBinary: undefined,
      integrity: undefined
    },
    Pattern {
      pattern: '/__w/roslibjs/roslibjs/test/require-shim.js',
      served: true,
      included: true,
      watched: true,
      nocache: false,
      weight: [ 1, 0, 0, 0, 0, 0 ],
      type: undefined,
      isBinary: undefined,
      integrity: undefined
    },
    Pattern {
      pattern: '/__w/roslibjs/roslibjs/test/*.test.js',
      served: true,
      included: true,
      watched: true,
      nocache: false,
      weight: [ 1, 0, 1, 0, 0, 0 ],
      type: undefined,
      isBinary: undefined,
      integrity: undefined
    }
  ],
  browserConsoleLogOptions: { level: 'debug', format: '%b %T: %m', terminal: true },
  customContextFile: null,
  customDebugFile: null,
  customClientContextFile: null,
  exclude: [ '/__w/roslibjs/roslibjs/test/karma.conf.js' ],
  logLevel: 'ALL',
  colors: true,
  autoWatch: false,
  autoWatchBatchDelay: 250,
  restartOnFileChange: false,
  usePolling: true,
  reporters: [ 'progress' ],
  singleRun: true,
  browsers: [ 'FirefoxHeadless' ],
  captureTimeout: 60000,
  pingTimeout: 5000,
  proxies: {},
  proxyValidateSSL: true,
  preprocessors: [Object: null prototype] {},
  preprocessor_priority: {},
  urlRoot: '/',
  upstreamProxy: undefined,
  reportSlowerThan: 0,
  loggers: [
    {
      type: 'console',
      layout: { type: 'pattern', pattern: '%[%d{DATETIME}:%p [%c]: %]%m' }
    }
  ],
  transports: [ 'polling', 'websocket' ],
  forceJSONP: false,
  plugins: [ 'karma-*' ],
  client: {
    args: [],
    useIframe: true,
    runInParent: false,
    captureConsole: true,
    clearContext: true,
    allowedReturnUrlPatterns: [ '^https?://' ],
    mocha: { timeout: 10000 }
  },
  defaultClient: {
    args: [],
    useIframe: true,
    runInParent: false,
    captureConsole: true,
    clearContext: true,
    allowedReturnUrlPatterns: [ '^https?://' ],
    mocha: { timeout: 10000 }
  },
  browserDisconnectTimeout: 2000,
  browserDisconnectTolerance: 0,
  browserNoActivityTimeout: 30000,
  processKillTimeout: 2000,
  concurrency: Infinity,
  failOnEmptyTestSuite: true,
  retryLimit: 2,
  detached: false,
  crossOriginAttribute: true,
  browserSocketTimeout: 20000,
  background: false,
  configFile: '/__w/roslibjs/roslibjs/test/karma.conf.js',
  runnerPort: 9200
}
01 11 [202](https://github.com/RobotWebTools/roslibjs/actions/runs/3368672977/jobs/5587483389#step:7:203)2 10:29:57.955:DEBUG [plugin]: Loading karma-* from /__w/roslibjs/roslibjs/node_modules
01 11 2022 10:29:57.961:DEBUG [plugin]: Loading plugin /__w/roslibjs/roslibjs/node_modules/karma-chai.
01 11 2022 10:29:57.962:DEBUG [plugin]: Loading plugin /__w/roslibjs/roslibjs/node_modules/karma-firefox-launcher.
01 11 2022 10:29:57.964:DEBUG [plugin]: Loading plugin /__w/roslibjs/roslibjs/node_modules/karma-mocha.
01 11 2022 10:29:57.969:DEBUG [web-server]: Instantiating middleware
01 11 2022 10:29:57.993:INFO [karma-server]: Karma v6.4.0 server started at http://localhost:9876/
01 11 2022 10:29:57.994:INFO [launcher]: Launching browsers FirefoxHeadless with concurrency unlimited
01 11 2022 10:29:57.997:INFO [launcher]: Starting browser FirefoxHeadless
01 11 2022 10:29:57.997:DEBUG [launcher]: null -> BEING_CAPTURED
01 11 2022 10:29:57.998:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-69133750
01 11 2022 10:29:57.999:DEBUG [launcher]: firefox http://localhost:9876/?id=69133750 -profile /tmp/karma-69133750 -no-remote -wait-for-browser -headless --start-debugger-server 6000
01 11 2022 10:30:57.998:WARN [launcher]: FirefoxHeadless has not captured in 60000 ms, killing.
01 11 2022 10:30:57.999:DEBUG [launcher]: BEING_CAPTURED -> BEING_KILLED
01 11 2022 10:30:58.024:DEBUG [launcher]: Process FirefoxHeadless exited with code null and signal SIGTERM
01 11 2022 10:30:58.024:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-691[337](https://github.com/RobotWebTools/roslibjs/actions/runs/3368672977/jobs/5587483389#step:7:338)50
01 11 2022 10:30:58.027:INFO [launcher]: Trying to start FirefoxHeadless again (1/2).
01 11 2022 10:30:58.027:DEBUG [launcher]: BEING_KILLED -> RESTARTING
01 11 2022 10:30:58.027:DEBUG [launcher]: RESTARTING -> FINISHED
01 11 2022 10:30:58.027:DEBUG [launcher]: FINISHED -> FINISHED
01 11 2022 10:30:58.027:DEBUG [launcher]: Restarting FirefoxHeadless
01 11 2022 10:30:58.027:DEBUG [launcher]: FINISHED -> BEING_CAPTURED
01 11 2022 10:30:58.027:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-69133750
01 11 2022 10:30:58.028:DEBUG [launcher]: firefox http://localhost:9876/?id=69133750 -profile /tmp/karma-69133750 -no-remote -wait-for-browser -headless --start-debugger-server 6000
01 11 2022 10:31:58.028:WARN [launcher]: FirefoxHeadless has not captured in 60000 ms, killing.
01 11 2022 10:31:58.029:DEBUG [launcher]: BEING_CAPTURED -> BEING_KILLED
01 11 2022 10:31:58.048:DEBUG [launcher]: Process FirefoxHeadless exited with code null and signal SIGTERM
01 11 2022 10:31:58.049:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-69133750
01 11 2022 10:31:58.051:INFO [launcher]: Trying to start FirefoxHeadless again (2/2).
01 11 2022 10:31:58.051:DEBUG [launcher]: BEING_KILLED -> RESTARTING
01 11 2022 10:31:58.051:DEBUG [launcher]: RESTARTING -> FINISHED
01 11 2022 10:31:58.051:DEBUG [launcher]: FINISHED -> FINISHED
01 11 2022 10:31:58.051:DEBUG [launcher]: Restarting FirefoxHeadless
01 11 2022 10:31:58.051:DEBUG [launcher]: FINISHED -> BEING_CAPTURED
01 11 2022 10:31:58.051:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-69133750
01 11 2022 10:31:58.052:DEBUG [launcher]: firefox http://localhost:9876/?id=69133750 -profile /tmp/karma-69133750 -no-remote -wait-for-browser -headless --start-debugger-server 6000
01 11 2022 10:32:58.052:WARN [launcher]: FirefoxHeadless has not captured in 60000 ms, killing.
01 11 2022 10:32:58.053:DEBUG [launcher]: BEING_CAPTURED -> BEING_KILLED
01 11 2022 10:32:58.072:DEBUG [launcher]: Process FirefoxHeadless exited with code null and signal SIGTERM
01 11 2022 10:32:58.073:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-69133750
01 11 2022 10:32:58.075:ERROR [launcher]: FirefoxHeadless failed 2 times (timeout). Giving up.
01 11 2022 10:32:58.075:DEBUG [karma-server]: Run complete, exiting.
01 11 2022 10:32:58.076:DEBUG [launcher]: Disconnecting all browsers
01 11 2022 10:32:58.076:DEBUG [launcher]: BEING_KILLED -> BEING_FORCE_KILLED
01 11 2022 10:32:58.076:DEBUG [proxy]: Destroying proxy agents
01 11 2022 10:32:58.077:DEBUG [launcher]: BEING_FORCE_KILLED -> FINISHED
01 11 2022 10:32:58.077:DEBUG [launcher]: FINISHED -> FINISHED
Warning: Task "karma:test" failed. Use --force to continue.
@birtles
Copy link
Collaborator

birtles commented Nov 2, 2022

Thanks for this report. Unfortunately I don't know anything about containered GitHub actions and I don't have any idea what might be going wrong based on the log. Sorry!

justinhynes added a commit to openedx/credentials that referenced this issue Nov 22, 2022
…ere is a known issue with headless firefox + Karma + Node16 and running tests in a containerized GitHub/GitHub Action environment). See karma-runner/karma-firefox-launcher#245.
justinhynes added a commit to openedx/credentials that referenced this issue Nov 22, 2022
[APER-2063]

This PR is for some cleanup after the Node 16 upgrade. The aim here is to update dependencies that will cause issues and to regenerate our `package-lock.json` file in the Credentials repo.

This PR also updates the Credentials repo to use an NPM script to run our linting tests. Previously, we used `gulp` to run our linters, but `gulp` is no longer an active project (no updates since 2019) and doesn't appear to be compatible with later version of Node/NPM.

We will stop running our (bok choy) acceptance tests suite as part of CI with these changes. They don't run successfully anymore after this upgrade and the bok choy framework has been deprecated for awhile now, there is nothing to gain by fixing them at this time.

- regenerate the `package-lock.json` file
- upgrade the `eslint-config-airbnb` and `eslint-plugin-react-hooks` dependencies
- convert linting to be kicked off by NPM script, rather than using our gulpfile
- update Makefile to call NPM script (intstead of Gulp)
- update translation files
- coverage tests in CI are failing because it can't find the firefox browser, add step to install the firefox browser
- don't run (bok choy) acceptance tests as part of our CI
- migrate from running our non-React JS tests with Firefox to Chromium (there is a known issue with headless firefox + Karma + Node16 and running tests in a containerized GitHub/GitHub Action environment). See karma-runner/karma-firefox-launcher#245.
@alexgibson
Copy link

We're also seeing this issue happening across multiple repositories. The error doesn't seem specific to a particular Node version running in the container, at least from my testing.

I'm still investigating, but actions/runner-images#6704 could be related.

Downgrading our image to ubuntu-20.04 seems to fix the issue temporarily.

@kemsky
Copy link

kemsky commented Mar 7, 2023

@birtles, on my desktop PC (Ubuntu 22.04) it also does not work, so it basically does not work in Ubuntu.

Playwright had similar problem: microsoft/playwright#20555

@birtles
Copy link
Collaborator

birtles commented Mar 9, 2023

It works for me on Node 16 with ubuntu-latest in a regular GitHub action. I've never used a contained GitHub action, I'm afraid.

@iamart
Copy link

iamart commented May 25, 2023

Same issue in aws ec2; on Ubuntu 22.04.2 LTS. Quite interesting, but it works fine in CircleCI's cimg/node:16.18-browsers which is based on ubuntu 22.04.1 LTS.

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

5 participants