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

Puppeteer for Firefox: wait for Firefox to close in case of a failure in the launcher #3662

Closed
ggrossetie opened this issue Dec 13, 2018 · 1 comment
Labels

Comments

@ggrossetie
Copy link

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 0.4.2 (puppeteer-firefox)
  • Platform / OS version: Ubuntu 18.04.1 LTS
  • Node.js version: v10.14.1

What steps will reproduce the problem?

  1. Execute await puppeteer.launch({dumpio: true}) on Ubuntu Trusty (Travis)
  2. The following trace can be seen in the console:
Failed to launch Firefox!
    at onClose (/home/travis/build/Mogztter/puppeteer-firefox-travis/node_modules/puppeteer-firefox/lib/firefox/Launcher.js:174:14)
    at Interface.helper.addEventListener (/home/travis/build/Mogztter/puppeteer-firefox-travis/node_modules/puppeteer-firefox/lib/firefox/Launcher.js:163:50)
    at Interface.emit (events.js:187:15)
    at Interface.close (readline.js:379:8)
    at Socket.onend (readline.js:157:10)
    at Socket.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1094:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Please note that the root cause is not printed.

What is the expected result?

The root cause should be printed in the console since we are using dumpio (ie. why Firefox failed to launch).

What happens instead?

The Firefox process does not trigger the event exit because when Firefox failed to launch, the exception is catch and the process is killed using killFirefox:

https://github.com/GoogleChrome/puppeteer/blob/8aaca4eb1ed4020c56d03e3957c1e64e9a0e8b45/experimental/puppeteer-firefox/lib/firefox/Launcher.js#L125-L128

Basically the error message is lost because the process is killed immediately (ie. the process does not have time to exit gracefully).
I think we should use waitForFirefoxToClose promise to give the process a chance to exit gracefully (within a timeout) and only after force kill the process if the process is still not closed:

https://github.com/GoogleChrome/puppeteer/blob/8aaca4eb1ed4020c56d03e3957c1e64e9a0e8b45/experimental/puppeteer-firefox/lib/firefox/Launcher.js#L92-L104

@mjzffr
Copy link
Contributor

mjzffr commented Jan 13, 2020

Thanks for the report. I'm closing this issue since the experimental puppeteer-firefox package is no longer maintained. A replacement will be available
later this year. You can learn more about Mozilla's work on this at https://wiki.mozilla.org/Remote

See also #5137

@mjzffr mjzffr closed this as completed Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@ggrossetie @aslushnikov @mjzffr and others