[🚀 Feature]: Send delete to geckodriver on timeout
See original GitHub issueBackground
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:
- Created a year ago
- Comments:11 (4 by maintainers)
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 theLocalNode
.@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.