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

Implement signal handler for graceful Firefox shutdown #595

Open
andreastt opened this issue Apr 3, 2017 · 4 comments
Open

Implement signal handler for graceful Firefox shutdown #595

andreastt opened this issue Apr 3, 2017 · 4 comments

Comments

@andreastt
Copy link
Contributor

geckodriver does currently not handle signals at all. We could handle SIGINT and prevent cases such as #285 (comment) by sending the ‘quit’ command to Marionette if a connection is open.

See also #285 (comment) for more context. Because Firefox does not gracefully handle SIGINTs itself, we could circumvent that with asking it to shut down itself.

cc @whimboo

@andreastt
Copy link
Contributor Author

@jgraham mentioned rust-lang/rfcs#1368.

@whimboo
Copy link
Collaborator

whimboo commented Oct 11, 2017

Please note that parts of it will be fixed with my patch on https://bugzilla.mozilla.org/show_bug.cgi?id=1403923. SIGINT would only be necessary if no connection to the application exists.

@whimboo
Copy link
Collaborator

whimboo commented Jan 12, 2018

It might not completely apply to this issue but please also note https://bugzilla.mozilla.org/show_bug.cgi?id=1430064. If geckodriver gets terminated by Selenium (a missing call to driver.quit()), it doesn't close Firefox at all.

@titusfortner
Copy link

It was discussed in SeleniumHQ/selenium#11303 that the different languages are ending sessions differently. If the program exits, but the DELETE command was never sent to the driver. Ruby and Python each attempt to kill the process that started the driver. The other bindings do not attempt this.

For Chrome/Edge/IE we can send a GET to the /shutdown endpoint, which in turn quits any open sessions. For Chrome/Edge, there is a parameter in options ("detach") that tells the driver not to close the browser when it receives the shutdown command.

Ruby uses a process group for the driver, which means it automatically kills driver & browser for all browsers.
Python can only do this for the driver, the browsers remain open unless DELETE is explicitly sent to driver for the session id.

It would be nice if all Selenium bindings could automatically end all drivers and associated browser processes when the program exits. Since the current behavior does not do this, and it is possibly intentional on the part of users, we would need to have a /shutdown supported by geckodriver and a detach option similar to Chrome in order to toggle desired behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants