geckodriver
geckodriver copied to clipboard
Calling Delete Session after Close Window causes 500 Internal Server Error
In order to help us efficiently investigate your issue, please provide the following information:
Firefox Version
53.0.2 (32-bit)
Platform
Windows
driver version
16.0.1
Selenium Version
3.4.0
Steps to reproduce -
Below is the step to reproduce
- [ ] A create driver object and launch the browser
- [ ] Perform driver.close()
- [ ] Perform driver.quit()
Logs-
Tried to run command without establishing a connection
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'XXXXXXX', ip: 'XX.XX.XX.XXX', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\h124795\AppData\Local\Temp\rust_mozprofile.0K9aVa2cfwmA, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=53.0.2, platformVersion=10.0, moz:processID=6048.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}]
Session ID: 28f25c88-bf88-43e5-9111-18bd9bdff2d6
** If any of the above are missing we will have to unfortunately close your issue. We will gladly reopen the issue once all the information requested has been added **
@raviautomation09 Can you please try use the latest nightly. I think this issue might have already been fixed but want to check.
If it still fails can you add the verbose log from GeckoDriver. You may need to look up in your driver bindings how to do that.
@raviautomation09 If you can't test this out by Monday next week (22 May) I will unfortunately need to close this issue.
The issue still persist after executing on Nightly. Below is the logs when driver.close() and driver.quit() is called:
driver.close():
1494925525976 webdriver::server DEBUG → DELETE /session/fe8a6452-f0e8-4755-afe1-2bd38e2dc55d/window 1494925525991 geckodriver::marionette TRACE → 16:[0,7,"close",{}] 1494925525996 Marionette TRACE 0 -> [0,7,"close",{}] 1494925525997 Marionette TRACE 0 <- [1,7,null,[]] 1494925525993 geckodriver::marionette TRACE � [1,7,null,[]] 1494925525993 webdriver::server DEBUG Last window was closed, deleting session 1494925525993 webdriver::server DEBUG Deleting session 1494925525993 geckodriver::marionette DEBUG Stopping browser process 1494925526180 webdriver::server DEBUG � 200 OK {"value": []}
driver.quit():
1494925526682 webdriver::server DEBUG → DELETE /session/fe8a6452-f0e8-4755-afe1-2bd38e2dc55d
1494925526682 webdriver::server DEBUG � 500 Internal Server Error {"value":{"error":"unknown error","message":"Tried to run command without establishing a connection","stacktrace":"stack backtrace:\n 0: 0x47f1a6 -
Selenium Exception:
Tried to run command without establishing a connection Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'IE1FLT85RHJC2', ip: '10.78.192.215', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{moz:profile=C:\Users\h124795\AppData\Local\Temp\rust_mozprofile.eku2Luin3ZBy, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=55.0a1, platformVersion=10.0, moz:processID=11780.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}] Session ID: fe8a6452-f0e8-4755-afe1-2bd38e2dc55d
@raviautomation09 Are you calling close and then quit? Its near impossible to solve this issue when you are only giving snippets of the log. We can't see what is happening around which could solve this problem.
Please give a full snippet, from session create to after the errors have happened. If we do not get the full log unfortunately we will need to close this issue as won't fix.
Do you run driver.quit() after driver.close()? If yes this will not work given that the close() command already closed the last window of Firefox, and as such the application already shutdown. So calling quit() afterward doesn't make sense.
Also I can see the following in the log for quit(): GET /shutdown did not match a known command. Is this a problem with your binding? It's not clear which one and which version you are using. So please report those details.
We should probably not return a 500 Internal Server Error when driver.quit() is called after a driver.close() implicitly ends the session.
The specification’s definition of the Delete Session command is:
- Try to close the session.
- Return success with data null.
You could interpret this the way geckodriver currently does, and return an error from step 1 because there is no Marionette connection (internal error), or you could try to end the session and if there is no session, return success anyway.
I think probably a specification clarification is needed here. For compatibility with other WebDriver implementations I think there should be a step 0 in Delete Session that returns immediately if there is no active session.
@AutomatedTester What do you think?
@AutomatedTester mind giving us some feedback about the proposal from @andreastt ?
we should do
I think probably a specification clarification is needed here. For compatibility with other WebDriver implementations I think there should be a step 0 in Delete Session that returns immediately if there is no active session.
I submitted https://github.com/w3c/webdriver/pull/926 to the specification.
For geckodriver we track the work in https://bugzilla.mozilla.org/show_bug.cgi?id=1403510.
Also I can see the following in the log for
quit():GET /shutdown did not match a known command. Is this a problem with your binding? It's not clear which one and which version you are using. So please report those details.
Thank you it helps me to solve my problem running tests on Firefox driver
Hello, I am using geckodriver 0.24 and firefox and I encountered the same original issue (which is closed now,so that is why I made the comment here ) https://github.com/mozilla/geckodriver/issues/1512 But with a major difference. The steps to generate the error didn't include delete session and this issue can't be reproduced always. This is the log: Failed to click element id=main-action-create after retrying 5 times with error Message: Tried to run command without establishing a connection Teardown:
Capture Page Screenshot Documentation: Takes screenshot of the current page and embeds it into log file. Start / End / Elapsed: 20200831 20:10:17.367 / 20200831 20:10:17.370 / 00:00:00.003 20:10:17.367 TRACE Arguments: [ ] 20:10:17.367 DEBUG GET http://127.0.0.1:36537/session/5012d69a-7726-47ba-919d-587e1d777790/screenshot {} 20:10:17.369 DEBUG Finished Request 20:10:17.369 TRACE Return: None 20:10:17.370 FAIL InvalidSessionIdException: Message: Tried to run command without establishing a connection
The steps to generate the error didn't include delete session and this issue can't be reproduced always.
@sofiand-png so why are you adding the comment on this issue then? If it's not related please file a new issue. Thanks.
The steps to generate the error didn't include delete session and this issue can't be reproduced always.
@sofiand-png so why are you adding the comment on this issue then? If it's not related please file a new issue. Thanks.
Because you set the original ticket as a duplicate of this one (although I don't see that clearly), so they should have the same root cause according to you. Isn't it ?
Again, this issue is about the "Delete Session" command and not anything else.
5 years on, and still no real solution to this problem?!