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.

[🚀 Feature]: Send delete to geckodriver on timeout

See original GitHub issue

Background

As you may know, there is a long standing issue with geckodriver that Firefox does not exit when geckodriver is terminated. The issue does not surface when a normal session close/quit is performed. In this case, a DELETE is sent to geckodriver and Firefox is shut down. However, if a session times out, OsProcess#destroy kills geckodriver only with an OS signal. And due to the aforementioned issue, Firefox itself is not killed.

Ideally, the geckodriver bug would be fixed. However, since it is a 5 year old bug with resolution being postponed from release to release I don’t think this will be resolved in geckodriver itself any time soon.

Proposal

The geckodriver codebase is not anywhere near my skillset, but the Selenium codebase is. If appreciated, I would like to contribute a fix such that org.openqa.selenium.remote.service.DriverService#stop is changed such that in the GeckoDriverService a “hook” is called to shut down geckodriver and Firefox by sending a DELETE to the session.

Note that the `` already contains related code:

URL killUrl = new URL(url.toString() + "/shutdown");
new UrlChecker().waitUntilUnavailable(3, SECONDS, killUrl);

However, geckodriver does not have such a /shutdown endpoint. An approach could be to factor this code out into a separate method and to override it in GeckoDriverService by sending an HTTP DELETE request to the /{session-id} endpoint.

DELETE on stop as default behaviour?

Note that I don’t really know why this isn’t default behaviour. org.openqa.selenium.grid.node.ProtocolConvertingSession already always forwards DELETE requests. But maybe there are other implementations that I’m not aware of though.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
diemolcommented, Jul 5, 2022

I guess I read things too quickly and I did not write my thoughts. This use case is only valid for the Grid, there is no timeout for the local execution.

A proper fix is to send a DELETE when the session reaches a time out. This probably needs to be implemented in the LocalNode.

1reaction
titusfortnercommented, Jul 5, 2022

@diemol is there a way the Grid can send the DELETE command to the drivers on nodes as part of closing the session?

Putting the fix in the Service code would prevent an otherwise valid feature when running locally. That said… because geckodriver doesn’t have a toggle, I think the behavior of the other languages is different from Java right now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Why does delete_all_cookies() sometimes throw a ...
I have no idea why and how delete_all_cookies() throws timeoutException ... Is there any way to prevent that? Traceback (most recent call last): ......
Read more >
SeleniumBase Docs
A complete framework for end-to-end testing with Python, pytest, behave-BDD, and WebDriver.
Read more >
Change log for 4.6.59
#3166; Avoid sending extra deletion calls for in-progress deletions #3141; Remove docker -it flag from addon-resizer Makefile #3165 ...
Read more >
I open sourced my 3080 notification script if anyone wants to ...
The only fix i found was to rename the geckodriver.exe. Quick question. Why not use http request to check the body instead of...
Read more >
pytest-sbase · PyPI
You need a different webdriver for each web browser you want to run automation on: chromedriver for Chrome, edgedriver for Edge, geckodriver 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