New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set timeout (15 sec) and retry (3 times) to create webdriver if first attempt failed #204

Closed
asolntsev opened this Issue Jul 26, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@asolntsev
Member

asolntsev commented Jul 26, 2015

Sometimes chromedriver hangs when trying to create new ChromeDriver instance. Thread just hangs in this state for more than a minute:

"Forwarding newSession on session null to remote" 
   java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
        at java.net.SocketInputStream.read(SocketInputStream.java:170)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:139)
        at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:155)
        at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:284)
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
        at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
        at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
        at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
        at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
        at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
        at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:143)
        at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:134)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:67)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:578)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
        at com.codeborne.selenide.impl.WebDriverThreadLocalContainer.createChromeDriver(WebDriverThreadLocalContainer.java:201)
        at com.codeborne.selenide.impl.WebDriverThreadLocalContainer.createDriver(WebDriverThreadLocalContainer.java:158)
        at com.codeborne.selenide.impl.WebDriverThreadLocalContainer.getAndCheckWebDriver(WebDriverThreadLocalContainer.java:101)
        at com.codeborne.selenide.WebDriverRunner.getAndCheckWebDriver(WebDriverRunner.java:113)
        at com.codeborne.selenide.impl.Navigator.navigateToAbsoluteUrl(Navigator.java:39)
        at com.codeborne.selenide.impl.Navigator.open(Navigator.java:20)
        at com.codeborne.selenide.Selenide.open(Selenide.java:52)

Selenide could use timeout (say, 15 seconds) when creating webdriver, and re-try after failure (say, 3 times).

@asolntsev asolntsev changed the title from retry to create webdriver if first attempt failed to set timeout (15 sec) and retry (3 times) to create webdriver if first attempt failed Jul 26, 2015

asolntsev added a commit that referenced this issue Jul 26, 2015

@asolntsev

This comment has been minimized.

Show comment
Hide comment
@asolntsev

asolntsev Jul 26, 2015

Member

Added property selenide.openBrowserTimeout. Default value is 15000 (15 seconds).
If Selenide fails to open a browser in this time, it re-tries 3 times and throws exception.

Member

asolntsev commented Jul 26, 2015

Added property selenide.openBrowserTimeout. Default value is 15000 (15 seconds).
If Selenide fails to open a browser in this time, it re-tries 3 times and throws exception.

@asolntsev asolntsev closed this Jul 26, 2015

@asolntsev asolntsev added this to the 2.20 milestone Jul 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment