karma-firefox-launcher: Launcher doesn't kill Firefox 68

Firefox : v68.0.1 OS : Window7 and Windows 10 Karma : v1.7.1 || v3.1.4 || 4.2.0 Firefox launcher : v1.1.0 Node.js : v8 || v10

Launcher doesn’t kill my Firefox 68, I tested with several version of nodejs without success. Maybe it’s cause of Electrolyse (e10s) maybe not. I tried to disable e10s for a moment with set MOZ_FORCE_DISABLE_E10S variable but unsuccessful, I created a little standalone code to test.

const spawn = require('child_process').spawn;
let firefox = spawn("pathToFirefox\\firefox.exe, [
    "http://localhost:9876/?id=anid",
    "-profile",
    "C:\\temp\karma-2456",
    "-no-remote",
    "-wait-for-browser"
]);
setTimeout(function killFirefox(){
    firefox.kill();
}, 10000)
firefox.on('exit', function(code, signal){
    console.log('Firefox exit');
});

Result: firefox is always running.

I tried with this version How to kill child processes that spawn their own child processes in Node.js but it doesn’t work for me.

has anybody an idea ?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 20 (4 by maintainers)

Commits related to this issue

Most upvoted comments

@dotnetCarpenter It looks like the fix for this is finally released!

Switching to Nightly (70.0) I can reproduce the problem and the changes in the kill-browser-process branch seem to fix it for me. If someone else can confirm that would be helpful.

I suspect what was happening with 69 is I triggered an error condition where the launcher process was disabled.

Unfortunately I still don’t have a good idea how to fix WSL.

Spoke to Mozilla folks. We can use MOZ_DEBUG_BROWSER_PAUSE=0 to get the launcher process to dump the child process ID to stderr and then read it back. See: https://wiki.mozilla.org/Platform/Integration/InjectEject/Launcher_Process/

It will produce output such as:

BROWSERBROWSERBROWSERBROWSER
  debug me @ 21968

However, I can’t seem to get this to work when calling from WSL. Even using WSLENV to ensure the environment variable gets shared, I can’t read back stderr.

[Windows 10] Managed to workaround this issue with the following :

  • set the env variable MOZ_LAUNCHER_PROCESS=1
  • set the Firefox user preference browser.launcherProcess.enabled = false ‘FirefoxTest’: { base: ‘Firefox’, prefs: { ‘toolkit.telemetry.reportingpolicy.firstRun’: false, // probably unnecessary ‘browser.launcherProcess.enabled’: false } }

Results :

  • In the Windows task manager, several FF instances appear to be instanciated
  • No timeout problem so --wait-for-browser is not required
  • Once tests terminate, all FF instances are cleanly destroyed