Open AlexanderArendar opened 7 years ago
For future reference, a test logging the length of the window handles array would be a good reproducible test case to have included for this.
I believe this is an issue in Marionette. I filed bug 1310992 about this.
@andreastt there's only one window handle at the time when close()
is called.
If you meant the handles which are retrieved by driver.getWindowHandles()
My tests are written in Scala and ScalaTest. I could do the minimal test and share on GitHub but that will need you to intall SBT, Scala, etc. Not sure if you need this.
The test itself if very simple, it initiates the driver, navigates to one web page, checks that few elements are present there and then tries to close the driver.
I am having this issue as well on Ubuntu 16.10 with FF 49.0, Marionette 0.11.1, Python 3.5.2, and Selenium 3.0.1 (everything at their current version)
This happens for both driver.quit() and driver.close() when there is only one window open.
Traceback (most recent call last):
File "/home/michael/Documents/Premonition/premonition-python-crawler/crawler/tools/CrawlerThread.py", line 612,
in run
return None
File "/usr/local/lib/python3.5/dist-packages/premtools-0.1-py3.5.egg/premtools/web/webpage.py", line 129, in __
exit__
self.close_page()
File "/usr/local/lib/python3.5/dist-packages/premtools-0.1-py3.5.egg/premtools/web/webpage.py", line 166, in cl
ose_page
self.driver.close()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 510, in close
self.execute(Command.CLOSE)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_res
ponse
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Failed to decode response from marionette
This is the geckodriver.log after normal operations:
(firefox:6014): Gdk-WARNING **: firefox: Fatal IO error 11 (Resource temporarily unavailable) on X server :1001.
Hello, When i try to use Firefox50.0.2 with geckodriver (v0.11.1-win32) with Selenium3.0.2 on Windows, Close Browser (Keyword from RF Selenium2Library) results in an error pop-up after closing the Firefox windows "Firefox has stopped working". Attached the geckodriver.log file.
And Error details from pop-up are as below:-
Problem signature: Problem Event Name: APPCRASH Application Name: firefox.exe Application Version: 50.0.2.6177 Application Timestamp: 583e4bb4 Fault Module Name: mozglue.dll Fault Module Version: 50.0.2.6177 Fault Module Timestamp: 583e4b91 Exception Code: 80000003 Exception Offset: 0000ed43 OS Version: 6.1.7601.2.1.0.274.10 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Also, i had tried some combinations and below are my findings (ref. https://github.com/robotframework/Selenium2Library/issues/614):-
RF3.0, FF47.0.2 (without geckodriver) and Selenium-2.53.6, Python 2.7.10 :- Works RF3.0, FF47.0.2 + geckodriver and Selenium-3.0.2, Python 2.7.10 :- Works RF3.0, FF48.0.2 + geckodriver and Selenium-3.0.2, Python 2.7.10 :- Works RF3.0, FF48.0.2 + geckodriver and Selenium-2.53.6, Python 2.7.10 :- Doesn't work. RF3.0, FF50.0.2 + geckodriver and Selenium-3.0.2, Python 2.7.10 :- Close Browser (Keyword from RF Selenium2Library) fails with error "Firefox has stopped working". RF3.0, FF50.0.2 + geckodriver and Selenium-2.53.6, Python 2.7.10 :- Fails to open the URL and gives error ""Firefox has stopped working"."
Thanks, ~alok
I have made some changes to the "close window" implementation of Marionette server on bug 1311350, so it returns the remaining window handles now.
As discussed with @andreastt we have a faked empty list of close() is called on the last window handle now. With that geckodriver should detect that Firefox has to be closed and should terminate the session. Andreas mentioned that he has some work in progress for that.
Indeed, some work is required in geckodriver for it to terminate the Firefox process when it receives an empty array of window handles after calling CloseWindow
.
I tried to check Bugzilla to find out the status and found this comment in bug 1311350,
Tracking Flags:
status-firefox50: wontfix
status-firefox51: wontfix
status-firefox52: fixed
status-firefox53: fixed
Does that mean, that this issue expected to be fixed with release of firefox 52?
@SlavikCA The fix comes in two parts: One to Marionette in Firefox, which will be available with 52, and one to geckodriver which has not yet been written.
@andreastt, could you please give some links where the necessary code would have to be put in? I do not actually see a closeWindow() method in Geckodriver. As it looks like it simply forwards the call to Webdriver. Thanks.
https://github.com/mozilla/geckodriver/blob/master/src/marionette.rs#L399-L411 needs to be modified to look at the response from sending a CloseWindow
command. If the returned array is empty, it should terminate the Firefox process before returning the response to the client.
Looks like some other work on webdriver-rust is necessary, which Andreas seems to have started to work on yesterday via https://github.com/mozilla/webdriver-rust/pull/64.
This should now be resolved with Firefox 52 or newer and geckodriver 0.14.0
I tried geckodriver 0.14.0 with FF 51.0.1, problem still exist.
Microsoft Windows [Version 6.3.9600]
cffi 1.7.0 click 6.7 colorama 0.3.7 cryptography 1.4 decorator 4.0.11 docutils 0.12 enum34 1.1.6 fake-factory 0.5.9 Flask 0.12 idna 2.1 ipaddress 1.0.16 itsdangerous 0.24 Jinja2 2.9.4 MarkupSafe 0.23 paramiko 2.0.1 pip 9.0.1 pyasn1 0.1.9 pycparser 2.14 pyfiglet 0.7.5 PyMySQL 0.7.6 python-dateutil 2.5.3 robotframework 3.0.1 robotframework-databaselibrary 0.8.1 robotframework-faker 3.0.0 robotframework-selenium2library 1.8.0 selenium 3.0.2 setuptools 20.10.1 six 1.10.0 subprocess.run 0.0.8 termcolor 1.1.0 Werkzeug 0.11.15 wheel 0.29.0 wrapt 1.10.8
1486434411868 addons.manager DEBUG Starting provider:
@xyngfei As it said above: Firefox 52 is required for the fix.
I tested and the fix works for me.
@SlavikCA
I tried with FF 52b04, it still has the same issue.
1486552172117 DeferredSave.extensions.json DEBUG Starting write 1486552172324 DeferredSave.extensions.json DEBUG Write succeeded 1486552172325 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 19 1486552173165 Marionette WARN Using deprecated data structure for setting timeouts 1486552173168 Marionette WARN Using deprecated data structure for setting timeouts 1486552202475 Marionette INFO New connections will no longer be accepted [Child 7864] ###!!! ABORT: Aborting on channel error.: file c:/builds/moz2_slave/m-beta-w32-0000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2143
We think that there's a race in the marionette shutdown procedure that perhaps leads to the socket being closed before the response has been sent. We are currently working on the best way to solve this.
It is possible that calling Services.startup.quit
with bitflags Ci.nsIAppStartup.eAttemptQuit
and Ci.nsIAppStartup.eForceKill
causes problems in the IPC subsystem. I have seen reports of crashes in MessageChannel.cpp before, but they have all been fixed and uplifted.
I also feel it’s important to add that even if this is printed in the shell on ending the session, it doesn’t really matter since the process is terminated. However, we should work to find the root cause of this.
@xyngfei @SlavikCA Is it possible for one of you to see if this generates a crash log? You can find crash logs in about:crashes.
So apparently geckodriver passes eForceQuit
in https://github.com/mozilla/geckodriver/blob/master/src/marionette.rs#L796 to the quitApplication
command, which Marionette thinks is a bitwise flag in http://searchfox.org/mozilla-central/source/testing/marionette/driver.js#2530-2533.
The nsIAppStartup
documentation says:
One and only one of the "Quit" flags must be specified. The
eRestart
flag may be bit-wise combined with one of the "Quit" flags to cause the application to restart after it quits.
So we are clearly wrong to pass both eForceQuit
and eAttemptQuit
, and I think Marionette is wrong to lump them together when additional flags are given as arguments. I would suggest the following:
eForceQuit
@andreastt
U can look at the logs file. Something it works well. However, you can see the ABORT info from log file. [Child 7864] ###!!! ABORT: Aborting on channel error.: file c:/builds/moz2_slave/m-beta-w32-0000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2143
Can someone on Windows please visit about:crashes and link the crash dump?
@andreastt Close No response and will not cause a crash. Is the crash dump required for quit?
C: \ Program Files (x86) \ Mozilla Firefox \ firefox.exe "--marionette --profile C: \ Users \ GameXG \ AppData \ Local \ Temp \ rust_mozprofile. .ZxIMKVhVAFKI is also empty.
View history also does not exist through selenium access to the records, it seems geckodriver before exiting all the records ...
Today I checked my Selenium nodes and few of them (not sure why not all of them) has about 70+ firefox.exe processes.
About:crahes
: No crash reports have been submitted.
I see few of these exceptions in C:\selenium\log\selenium_node
on the node (not hub), not sure if it really has any meaning for this:
19:23:56.187 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'optsel02', ip: '10.164.0.170', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_40'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(Unknown Source)
...
org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:86)
... 9 more
Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@46149a5e, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@46149a5e, version=, platform=ANY, firefox_profile=UEsDBBQACAgIADSVRkoAAAAAAAAAA...}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'optsel02', ip: '10.164.0.170', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_40'
...
19:23:56.270 WARN - Exception: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@46149a5e, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@46149a5e, version=, platform=ANY, firefox_profile=UEsDBBQACAgIADSVRkoAAAAAAAAAA...}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'optsel02', ip: '10.164.0.170', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_40'
Driver info: driver.version: FirefoxDriver
@SlavikCA That seems entirely unrelated.
Adding my finding to this issue.
Browser : Firefox Nightly 54.0, Firefox 51.0 Selenium : 3.1.0 GeckoDriver : geckodriver-v0.14.0-win64
GeckoDriver is happy with most of the websites but it is crashing for some main websites.
http://www.cnn.com/ http://www.dailymail.co.uk/ https://www.bet365.com/ http://www.foxnews.com/ http://abcnews.go.com/
Most of the other site I have checked worked without any problem
When driver.quit() is called it will show the message "Plugin container for Nightly stopped working"
Problem signature: Problem Event Name: APPCRASH Application Name: plugin-container.exe Application Version: 54.0.0.6264 Application Timestamp: 58b02aac Fault Module Name: xul.dll Fault Module Version: 54.0.0.6264 Fault Module Timestamp: 58b029ef Exception Code: 80000003 Exception Offset: 008cb329 OS Version: 6.1.7601.2.1.0.256.4 Locale ID: 2057 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our privacy statement offline: C:\windows\system32\en-US\erofflps.txt
I am sharing the code I have used. This issue is consistent for any of the above websites.
package CrossBrowser.Tests.POC;
import java.net.URL;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.annotations.Test;
public class GeckoDriverIssue {
WebDriver driver;
@Test(description = "Launch Website")
public void geckoDriverIssue() {
try {
FirefoxProfile fp = new FirefoxProfile();
DesiredCapabilities firefoxCapabilities = DesiredCapabilities.firefox();
firefoxCapabilities.setCapability(FirefoxDriver.PROFILE, fp);
firefoxCapabilities.setCapability("marionette", true);
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), firefoxCapabilities);
String webSite = "http://www.cbsnews.com/";
driver.get(webSite);
} catch (Exception e) { }
finally {
driver.quit();
}
}
}
Thanks, Robins
@andreastt
I'm part of an organization that's keen on having this problem resolved. Would there be anyway we could be of help? For example, what if we created a Windows VM on a public cloud where you could reproduce this problem reliably, and shared with you its access credentials?
Today I tested with gecko driver 0.15 and selenium client library 3.3.0 Firefox 52.0
Still its not closing the browser using driver.close();
package demo1;
import java.io.IOException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxOptions; import org.openqa.selenium.firefox.FirefoxProfile; import org.openqa.selenium.remote.DesiredCapabilities;
public class Automation {
public static void main(String[] args) throws InterruptedException, IOException {
DesiredCapabilities caps = new FirefoxOptions()
.setProfile(new FirefoxProfile())
.addTo(DesiredCapabilities.firefox());
caps.setCapability("acceptInsecureCerts", true);
caps.setJavascriptEnabled(true);
caps.setCapability("marionette", true);
System.setProperty("webdriver.gecko.driver","C:\\Workspace\\Demo\\geckodriver.exe");
WebDriver driver = new FirefoxDriver(caps);
driver.get("https://l4dridap1274:8446/web/hrbpo/client-tooling-login");
driver.close();
}
}
its not closing the browser.
We hope that this issue is being addressed with https://bugzilla.mozilla.org/show_bug.cgi?id=1337743, which is on track for uplift to Aurora and Beta trains. It would be great if someone could grab the latest Nightly and see if it fixes the Aborting on channel error
problem.
In the meantime I have also submitted https://github.com/mozilla/geckodriver/pull/590 (addressing https://github.com/mozilla/geckodriver/issues/225) to disable Flash from starting in the first place, which should hopefully cause the plugin container not to trigger.
cc @mjzffr
Interestingly I am able to reproduce the error by starting geckodriver, starting a session, and then killing the geckodriver process with SIGINT:
% cargo run
Compiling geckodriver v0.15.0 (file:///home/ato/src/github.com/mozilla/geckodriver)
Finished dev [unoptimized + debuginfo] target(s) in 6.27 secs
Running `target/debug/geckodriver`
1490892752667 geckodriver INFO Listening on 127.0.0.1:4444
1490892754911 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.uusBLSSfVRuH
1490892754912 geckodriver::marionette INFO Starting browser /usr/local/firefox/firefox-bin with args []
1490892754913 geckodriver::marionette INFO Connecting to Marionette on localhost:33703
1490892755344 Marionette INFO Listening on port 33703
^?4721: signal: interrupt
% [Child 4932] ###!!! ABORT: Aborting on channel error.: file /builds/slave/m-cen-l64-ntly-000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2056
[Child 4932] ###!!! ABORT: Aborting on channel error.: file /builds/slave/m-cen-l64-ntly-000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2056
###!!! [Child][MessageChannel] Error: (msgtype=0x420003,name=PCompositable::Msg_Destroy) Channel error: cannot send/recv
###!!! [Child][MessageChannel] Error: (msgtype=0x420003,name=PCompositable::Msg_Destroy) Channel error: cannot send/recv
In another shell (the data here isn’t important):
% curl -d '{"capabilities": {"alwaysMatch": {"proxy": {"proxyAutoconfigUrl": "http:\/\/192.168.0.2:10144\/proxy.pac","proxyType": "pac"}}}}' http://localhost:4444/session
This could be a slightly different issue than the one reported here, since interrupting geckodriver does not send the quit
/quitApplication
command to Marionette, but terminates the Firefox subprocess from within geckodriver.
It could be beneficial for geckodriver to implement proper signal handling to attempt a clean shutdown when interrupted. But again, I have to stress this is a slightly different issue than the one reported here.
There is no way for a clean shutdown of Firefox given that it doesn't support SIGINT yet. So the only way is to use SIGKILL or quit(), whereby the latter does not force a shutdown and could be aborted.
Regarding the message channel errors you can also see those if you hit ctrl+c while Firefox is starting. Not sure if it is expected that the graphics process/thread is bailing out that hard.
It is not Firefox that is receiving SIGINT in the example above. geckodriver receives SIGINT, but because it doesn’t handle the signal, I’m assuming the Firefox subprocess gets terminated forcefully. It could implement a signal handler for SIGINT that sent the ‘quit’ command to Marionette if a connection was open before trying to terminate it.
Sending the quit()
command would be a nice workaround we could do until Firefox is able to correctly handle SIGINT
.
This fix seems to work for us. Firefox Nightly no longer throws up an error dialog when it's being closed (Firefox has stopped working
), unlike Firefox Stable which almost always does so.
We're looking forward to this being released along with Firefox 54.0. Thanks for the fix @andreastt
This workaround is working for me - just open any Firefox service page (config, profile or etc.) before quit. Here is example of code:
driver.get("about:config"); driver.quit();
Server details:
OS: Windows Server 2008 R2 Firefox: 52.0 (32 bit) GeckoDriver: 0.14.0 Selenium WebDriver: 3.0.1
Firefox is still crashing for us with geckodriver 0.16.1 and firefox 54.0b5:
firefox_1 | [Parent 191] WARNING: pipe error (56): Connection reset by peer: file /home/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_
firefox_1 | ###!!! [Parent][MessageChannel] Error: (msgtype=0x2C0082,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
firefox_1 | ###!!! [Parent][MessageChannel] Error: (msgtype=0x3E0003,name=PCompositorBridge::Msg_DidComposite) Channel error: cannot send/recv
firefox_1 | ###!!! [Parent][RunMessage] Error: Channel error: cannot send/recv
firefox_1 | ###!!! [Parent][RunMessage] Error: Channel error: cannot send/recv
firefox_1 | ###!!! [Parent][RunMessage] Error: Channel error: cannot send/recv
firefox_1 | ###!!! [Parent][RunMessage] Error: Channel error: cannot send/recv
firefox_1 | ###!!! [Parent][MessageChannel] Error: (msgtype=0x3E0003,name=PCompositorBridge::Msg_DidComposite) Channel error: cannot send/recvkkk
You can try with this docker image: https://hub.docker.com/r/cvakiitho/docker-selenium
@cvakiitho I don’t actually think that constitutes as a crash. It happens on shutdown because some of the IPC channel receivers are getting shut down, which you would expect as Firefox is quitting. On Linux this doesn’t cause any problems as far as I’m aware?
@andreastt I use docker node https://github.com/SeleniumHQ/docker-selenium , this is any output I can get from it, and see in vnc that firefox page crashed.
Can I turn on some extensive logging somewhere?
When I hear docker-selenium it hardly reminds me on https://bugzilla.mozilla.org/show_bug.cgi?id=1323701 where we someone else faces crashes too. It might be related.
If you have a chance to VNC into the node, you could open Firefox and go to about:crashes
. Submit one of those crashes and tell us the crash id.
about:crashes is empty, firefox doesn't crash completely( I think that versions <54 were crashing), only tab crashes.
Thanks for the link, it seems to be the same issue, especially this part:
This is a little tricky as right now I can't reproduce the failures on my local machine (OSX) running the exact same versions of Firefox / Selenium, but they occur 100% of the time in docker-selenium in our Jenkins job.
Whatever happens for this bug it depends on a fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1338771, which is the crash I was thinking of.
A workaround would be to disable e10s (multiprocess) for Firefox.
Ok, it looks like everything is fine with attached /dev/shm volume to docker container.
Thanks for the feedback.
Everyone else who is affected by this issue, can you please tell if it's because you also use Docker + Selenium? Does the https://github.com/mozilla/geckodriver/issues/285#issuecomment-300534925 help?
For Docker, setting --shm-size
to something sufficiently larger than the default 64M
should also work, if my speculation in bug 1338771 comment #10 is right. TaskCluster sets it to 1800000000
(1800M
, give or take).
In principle Gecko could handle shared memory exhaustion more gracefully, at least enough to give a useful error message, but this causes problems that haven't been figured out yet.
Hi All, update of Firefox to 54.0 eliminated this issue for me on Windows 10.
Hey Guys, I am getting this message after execution of my simple script. System and Configuration used: Ubuntu 16.04, 64 bit, Geckodriver v0.17.0(linux) and FF version 54.0. After reading the previous comments above tried to comment driver.close() and driver.quit() still the message is shown. Also tried with single FF window still message is displayed.
Simple Script ->
package automationFramework;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Gecko_Driver {
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.toolsqa.com");
Thread.sleep(5000);
driver.close();
} }
@VikasSalunke which message is shown? The lines above don't show anything specific to a failure.
@whimboo The message I have mentioned in the above comment. Also the FF browser gets close before completing the script execution.
Guys any solution for the above problem. I searched and found such error can be fixed by using Firefox profile. DesiredCapabilities caps = new FirefoxOptions()
.setProfile(new FirefoxProfile())
.addTo(DesiredCapabilities.firefox());
WebDriver driver = new FirefoxDriver(caps);
I tried but still the same error mentioned in the Previous Post.
My OS properties:
In 'About Mozilla Firefox' info I can see this:
I have Selenium WebDriver java 3.0.0. Gecko driver version is geckodriver-v0.11.1-linux64.tar.gz
When I run a simple ScalaTest test suite with 1 test which calls the driver.close in the end there's nothing happening, the test reports as passed but the Firefox window is not closed. Here is a full output from the console:
Note that last 4 lines in the output before the final line is the output of the test.