MarketSquare / robotframework-seleniumlibrary-java

Java port of the Python based SeleniumLibrary for Robot Framework
Apache License 2.0
23 stars 16 forks source link

GeckoDriver randomly returns connection refused error #21

Closed ehhc closed 6 years ago

ehhc commented 7 years ago

Hi, I have the following issue and am a little bit clueless what might cause it: In my test environment my tests randomly fail because connection refused exceptions (see stacktrace below). I’m using a CentOS 7 System with the newest available Firefox Version (Firefox 52) and the belonging GeckoDriver Version (geckoDriver v0.17). I have found your discussion here: https://groups.google.com/forum/#!searchin/robotframework-users/Connection$20refused|sort:date/robotframework-users/WNurQlk_m5Y/A5jil_1sCQAJ but no working solution is mentioned. My initial thought was that I might use an outdated setup, but Firefox 52 is the newest version available for Centos 7 and is the official supported one. The GeckoDriver Version can’t be updated as well because the newer versions don’t support Firefox 52. Updating the Browser and the GeckoDriver (as mentioned in the google discussion) isn’t a possible option therefore.. Do you have any ideas what might cause my problem? As I said it only happens randomly so that I can’t point to a concrete cause.. Any ideas? Thanks in advance for your help

org.openqa.selenium.WebDriverException: connection refused
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'jenkins-slave', ip: 'XXX', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-327.18.2.el7.x86_64', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
   0:           0x57af6d - backtrace::backtrace::trace::h59229d13f6a8837d
   1:           0x57b0c2 - backtrace::capture::Backtrace::new::h23089c033eded8f0
   2:           0x4472fc - webdriver::error::WebDriverError::new::h0b226f62ff19e120
   3:           0x4514c1 - geckodriver::marionette::MarionetteHandler::create_connection::hd468f55550be3626
   4:           0x426854 - <webdriver::server::Dispatcher<T, U>>::run::h62323eaff3e71b8c
   5:           0x40935c - std::panicking::try::do_call::hb7e6ff6d130a72cf
   6:           0x5de23a - panic_unwind::__rust_maybe_catch_panic
                        at /checkout/src/libpanic_unwind/lib.rs:98
   7:           0x41c003 - <F as alloc::boxed::FnBox<A>>::call_box::hd6ceeda495c4fa0e
   8:           0x5d68d4 - alloc::boxed::{{impl}}::call_once<(),()>
                        at /checkout/src/liballoc/boxed.rs:650
                         - std::sys_common::thread::start_thread
                        at /checkout/src/libstd/sys_common/thread.rs:21
                         - std::sys::imp::thread::{{impl}}::new::thread_start
                        at /checkout/src/libstd/sys/unix/thread.rs:84   
13:17:16.969    DEBUG   java.lang.RuntimeException: 
    at org.robotframework.javalib.library.AnnotationLibrary.retrieveInnerException(AnnotationLibrary.java:148)
    at org.robotframework.javalib.library.AnnotationLibrary.runKeyword(AnnotationLibrary.java:130)
    at com.github.markusbernhardt.seleniumlibrary.SeleniumLibrary.runKeyword(SeleniumLibrary.java:499)
    at robot.model.testcase$py.visit$7(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/testcase.py:74)
    at robot.model.testcase$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/testcase.py)
    at robot.model.itemlist$py.visit$11(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/itemlist.py:75)
    at robot.model.itemlist$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/itemlist.py)
    at robot.model.visitor$py.visit_suite$2(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/visitor.py:88)
    at robot.model.visitor$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/visitor.py)
    at robot.model.testsuite$py.visit$19(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/testsuite.py:161)
    at robot.model.testsuite$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/testsuite.py)
    at robot.model.itemlist$py.visit$11(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/itemlist.py:75)
    at robot.model.itemlist$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/itemlist.py)
    at robot.model.visitor$py.visit_suite$2(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/visitor.py:88)
    at robot.model.visitor$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/visitor.py)
    at robot.model.testsuite$py.visit$19(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/testsuite.py:161)
    at robot.model.testsuite$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/testsuite.py)
    at robot.model.itemlist$py.visit$11(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/itemlist.py:75)
    at robot.model.itemlist$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/itemlist.py)
    at robot.model.visitor$py.visit_suite$2(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/visitor.py:88)
    at robot.model.visitor$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/visitor.py)
    at robot.model.testsuite$py.visit$19(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/testsuite.py:161)
    at robot.model.testsuite$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/model/testsuite.py)
    at robot.run$py.main$3(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/run.py:452)
    at robot.run$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/run.py)
    at robot.utils.application$py._execute$10(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/utils/application.py:94)
    at robot.utils.application$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/utils/application.py)
    at robot.utils.application$py.execute_cli$5(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/utils/application.py:49)
    at robot.utils.application$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/utils/application.py)
    at robot.run$py.run_cli$7(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/run.py:489)
    at robot.run$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/run.py)
    at robot.jarrunner$py._run$3(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/jarrunner.py:64)
    at robot.jarrunner$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/jarrunner.py)
    at robot.jarrunner$py.run$2(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/jarrunner.py:57)
    at robot.jarrunner$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/build/Lib/robot/jarrunner.py)
    at org.robotframework.RobotRunner.run(RobotRunner.java:74)
    at org.robotframework.RobotFramework.run(RobotFramework.java:61)
    at org.robotframework.RobotFramework.main(RobotFramework.java:35)
Caused by: com.github.markusbernhardt.seleniumlibrary.SeleniumLibraryFatalException: org.openqa.selenium.WebDriverException: connection refused
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'jenkins-slave', ip: 'XXX', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-327.18.2.el7.x86_64', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
   0:           0x57af6d - backtrace::backtrace::trace::h59229d13f6a8837d
   1:           0x57b0c2 - backtrace::capture::Backtrace::new::h23089c033eded8f0
   2:           0x4472fc - webdriver::error::WebDriverError::new::h0b226f62ff19e120
   3:           0x4514c1 - geckodriver::marionette::MarionetteHandler::create_connection::hd468f55550be3626
   4:           0x426854 - <webdriver::server::Dispatcher<T, U>>::run::h62323eaff3e71b8c
   5:           0x40935c - std::panicking::try::do_call::hb7e6ff6d130a72cf
   6:           0x5de23a - panic_unwind::__rust_maybe_catch_panic
                        at /checkout/src/libpanic_unwind/lib.rs:98
   7:           0x41c003 - <F as alloc::boxed::FnBox<A>>::call_box::hd6ceeda495c4fa0e
   8:           0x5d68d4 - alloc::boxed::{{impl}}::call_once<(),()>
                        at /checkout/src/liballoc/boxed.rs:650
                         - std::sys_common::thread::start_thread
                        at /checkout/src/libstd/sys_common/thread.rs:21
                         - std::sys::imp::thread::{{impl}}::new::thread_start
                        at /checkout/src/libstd/sys/unix/thread.rs:84
    at com.github.markusbernhardt.seleniumlibrary.keywords.BrowserManagement.openBrowser(BrowserManagement.java:409)
    at com.github.markusbernhardt.seleniumlibrary.keywords.BrowserManagement.openBrowser(BrowserManagement.java:216)
    at com.github.markusbernhardt.seleniumlibrary.keywords.BrowserManagement.openBrowser(BrowserManagement.java:211)
    at com.github.markusbernhardt.seleniumlibrary.keywords.BrowserManagement.openBrowser(BrowserManagement.java:206)
    at com.github.markusbernhardt.seleniumlibrary.keywords.BrowserManagement.openBrowser(BrowserManagement.java:201)
    at org.robotframework.javalib.reflection.KeywordInvoker.invoke(KeywordInvoker.java:50)
    at org.robotframework.javalib.beans.annotation.AnnotationKeywordExtractor$1.execute(AnnotationKeywordExtractor.java:62)
    at org.robotframework.javalib.beans.annotation.AnnotationKeywordExtractor$2.execute(AnnotationKeywordExtractor.java:84)
    at org.robotframework.javalib.library.KeywordFactoryBasedLibrary.runKeyword(KeywordFactoryBasedLibrary.java:37)
    at org.robotframework.javalib.library.AnnotationLibrary.runKeyword(AnnotationLibrary.java:128)
    ... 215 more
Caused by: org.openqa.selenium.WebDriverException: connection refused
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'jenkins-slave', ip: 'XXX', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-327.18.2.el7.x86_64', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
   0:           0x57af6d - backtrace::backtrace::trace::h59229d13f6a8837d
   1:           0x57b0c2 - backtrace::capture::Backtrace::new::h23089c033eded8f0
   2:           0x4472fc - webdriver::error::WebDriverError::new::h0b226f62ff19e120
   3:           0x4514c1 - geckodriver::marionette::MarionetteHandler::create_connection::hd468f55550be3626
   4:           0x426854 - <webdriver::server::Dispatcher<T, U>>::run::h62323eaff3e71b8c
   5:           0x40935c - std::panicking::try::do_call::hb7e6ff6d130a72cf
   6:           0x5de23a - panic_unwind::__rust_maybe_catch_panic
                        at /checkout/src/libpanic_unwind/lib.rs:98
   7:           0x41c003 - <F as alloc::boxed::FnBox<A>>::call_box::hd6ceeda495c4fa0e
   8:           0x5d68d4 - alloc::boxed::{{impl}}::call_once<(),()>
                        at /checkout/src/liballoc/boxed.rs:650
                         - std::sys_common::thread::start_thread
                        at /checkout/src/libstd/sys_common/thread.rs:21
                         - std::sys::imp::thread::{{impl}}::new::thread_start
                        at /checkout/src/libstd/sys/unix/thread.rs:84
    at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
    at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
    at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
    at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:217)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:140)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:106)
    at com.github.markusbernhardt.seleniumlibrary.keywords.BrowserManagement.createLocalWebDriver(BrowserManagement.java:1384)
    at com.github.markusbernhardt.seleniumlibrary.keywords.BrowserManagement.createWebDriver(BrowserManagement.java:1372)
    at com.github.markusbernhardt.seleniumlibrary.keywords.BrowserManagement.openBrowser(BrowserManagement.java:397)
    ... 228 more
Hi-Fi commented 7 years ago

Is same thing happening with library version 3.5.3.2? 3.6.0.0 might have some issues, and marked as "pre-release" because of broken phantomJS support.

ehhc commented 7 years ago

Hi, i was using version 3.5.3.1 and updated to 3.5.3.2 now. Since the issue is happening randomly i can't yet say if that fixed the issue. Do you have any ideas what might cause the issue?

Thanks for your help

Edit: It's just a guess because i can't verify that idea but i was wondering if the issue might happen when the test environment (which is in fact a jenkins server) is quite busy. Is it possible that the browser take to much time to open and therefore causes a connection refused exception? At the other hand, our jenkins server has a very good cpu and should be able to handle the robot test without any problems..

ehhc commented 7 years ago

Update: The update to version 3.5.3.1 didn't solved the issue unfortunately.. Any ideas?

Hi-Fi commented 7 years ago

Sadly no. Initial thought is that it's issue in Selenium or environment, as library is just using those as a dependencies, and failure is not happening every time. Also Firefox was not working with Travis builds, so automated verification using that is not available (and could show something).

ehhc commented 6 years ago

Hi, is it somehow possible to pass the "-v" (= verbose) option to selenium? That's what was suggested by the selenium community..

ehhc commented 6 years ago

Hi there, i found an ugly but usable solution: i wrap the open browser keyword into a wait until keyword succeeds. Since the issue only happens (randomly) at the first try to open the browser, the second try succeeds.. So even though it’s not quite nice, it’s working now. Thanks for your help nevertheless.