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.

Random errors : cannot start Firefox/FirefoxHeadless

See original GitHub issue

Firefox : v67.0.3 OS : Ubuntu 19.04 and Windows 10 Karma : v4.1.0 Firefox launcher : v1.1.0 Node.js : v12.4.0

I’ve some projects whose Karma tests work as expected when I’m using the Chrome launcher. But when I use the Firefox launcher, I get the following error:

0 06 2019 19:37:21.060:INFO [karma-server]: Karma v4.1.0 server started at http://0.0.0.0:9876/
20 06 2019 19:37:21.062:INFO [launcher]: Launching browsers Firefox with concurrency unlimited
20 06 2019 19:37:21.067:INFO [launcher]: Starting browser Firefox
20 06 2019 19:37:21.124:ERROR [launcher]: Cannot start Firefox
	
20 06 2019 19:37:21.124:ERROR [launcher]: Firefox stdout: 
20 06 2019 19:37:21.124:ERROR [launcher]: Firefox stderr: 
20 06 2019 19:37:21.127:INFO [launcher]: Trying to start Firefox again (1/2).
20 06 2019 19:37:21.181:ERROR [launcher]: Cannot start Firefox
	
20 06 2019 19:37:21.181:ERROR [launcher]: Firefox stdout: 
20 06 2019 19:37:21.181:ERROR [launcher]: Firefox stderr: 
20 06 2019 19:37:21.183:INFO [launcher]: Trying to start Firefox again (2/2).
20 06 2019 19:37:21.237:ERROR [launcher]: Cannot start Firefox
	
20 06 2019 19:37:21.238:ERROR [launcher]: Firefox stdout: 
20 06 2019 19:37:21.238:ERROR [launcher]: Firefox stderr: 
20 06 2019 19:37:21.239:ERROR [launcher]: Firefox failed 2 times (cannot start). Giving up.
[19:37:21] 'test:browser' errored after 585 ms
[19:37:21] Error: karma: 1
    at ChildProcess.<anonymous> (/repo/js/enum.js/gulpfile.esm.js:93:40)
    at ChildProcess.emit (events.js:200:13)
    at ChildProcess.EventEmitter.emit (domain.js:494:23)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

This error seems to be random: on some projects, the launcher works as expected (for example: https://github.com/cedx/lcov.js). On other projects, the launcher triggers the error (for example: https://github.com/cedx/enum.js).

For the projects that fail, it also seems to be random: the error is triggered on Ubuntu 19.04 and Windows 10, but not on TravisCI with Ubuntu 16.04 (for example: https://travis-ci.com/cedx/enum.js/jobs/209733946).

My Karma config (which is the same on the two mentioned projects):

module.exports = config => config.set({
  basePath: require('path').resolve(__dirname, '..'),
  browsers: ['FirefoxHeadless'],
  files: [
    {pattern: 'lib/**/*.js', type: 'module'},
    {pattern: 'test/**/*.js', type: 'module'}
  ],
  frameworks: ['mocha', 'chai'],
  reporters: ['progress'],
  singleRun: true
});

Using Firefox, instead of FirefoxHeadless, does not change anything (i.e. same error).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:18

github_iconTop GitHub Comments

5reactions
birtlescommented, Jul 30, 2019

@sebavan Thanks for confirming. I was planning on digging into the Ubuntu issues in #93 before releasing (assuming I even have the access required to submit a new release) but haven’t had a chance to set up a VM for it yet.

Let me have another look at Ubuntu later this week (I’m currently traveling) and if I can’t fix it easily I’ll try to release another version.

4reactions
birtlescommented, Jul 16, 2019

Right, that’s because the browser process will run in the background and on the second time through it will be running when the launcher tries to connect.

Depending on the load on your machine it might connect on the third time or it might fail altogether. With -wait-for-browser it will succeed first time.

I put up PR #95 for this but there seems to be something wrong with the CI for this repository. Looking at other PRs too it looks like no one is maintaining this anymore so I’m not sure if the PR will get merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Headless Firefox doesn't work - Mozilla Support
I got it to work on Linux. I'm using a clean profile and use the Profile Manager to create a profile (test-ss) and...
Read more >
"Failed to decode response from marionette" message in ...
It appears to randomly crash the headless browser and then all of the browserObjt.get('url...') no longer work. The error messages say: Message: ...
Read more >
Fix "firefox is already running" issue in Linux
A really easy way is to just open a terminal, run firefox -P , and either delete the ...
Read more >
Configuring Selenium to Run Headless, Without a Desktop
The problem is that you need to run a full browser (I was using Firefox) on a web or file server that doesn't...
Read more >
How to fix common Selenium errors? - Ultimate QA
This article covers all the common errors including Firefox and Selenium ... Cannot start compilation: the output path is not specified for ...
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