WebDriverException: Error forwarding the new session Error forwarding the request Read timed out

4,164 views
Skip to first unread message

presje...@gmail.com

unread,
Apr 24, 2016, 1:08:07 AM4/24/16
to Selenium Users
Using:
  • selenium grid
  • selenium-standalone 2.53.0
  • chrome driver 2.21
  • centOS 7

Node.json file:

{
 "capabilities":
     [
       {
         "browserName": "chrome",
         "maxInstances": 10,
         "seleniumProtocol": "WebDriver"
       }
     ],
 "configuration":
 {
   "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
   "maxSession": 10,
   "port": 5555,
   "register": true,
   "registerCycle": 5000,
   "hub": "http://x.x.x.x:4441"
 }
}


Hub options: -role hub -host x.x.x.x -port 4441 -log /var/log/selenium/selenium.log -browserTimeout 60 -timeout 30


Every few iterations I get the following error:

org.openqa.selenium.WebDriverException: Error forwarding the new session Error forwarding the request Read timed out
Command duration or timeout: 134.05 seconds
Build info: version: '2.44.0', revision: '76d78cf323ce037c5f92db6c1bba601c2ac43ad8', time: '2014-10-23 13:11:40'
System info: host: 'campnou', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.16.0-4-amd64', java.version: '1.8.0_77'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
        ...
at backtype.storm.daemon.executor$fn__5694$tuple_action_fn__5696.invoke(executor.clj:690)
at backtype.storm.daemon.executor$mk_task_receiver$fn__5615.invoke(executor.clj:436)
at backtype.storm.disruptor$clojure_handler$reify__5189.onEvent(disruptor.clj:58)
at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:132)
at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:106)
at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80)
at backtype.storm.daemon.executor$fn__5694$fn__5707$fn__5758.invoke(executor.clj:819)
at backtype.storm.util$async_loop$fn__545.invoke(util.clj:479)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.WebDriverException: Error forwarding the new session Error forwarding the request Read timed out
Build info: version: '2.44.0', revision: '76d78cf323ce037c5f92db6c1bba601c2ac43ad8', time: '2014-10-23 13:11:40'
System info: host: 'campnou', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.16.0-4-amd64', java.version: '1.8.0_77'
Driver info: driver.version: unknown
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:115)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:83)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:808)
at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.seleniumhq.jetty9.server.Server.handle(Server.java:499)
at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:310)
at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.seleniumhq.jetty9.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
... 1 more

Node log:

14:12:01.426 DEBUG [26] org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
14:12:01.427 DEBUG [26] org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
14:12:01.427 DEBUG [26] org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {}->http://x.x.x.x:4441][total kept alive: 1; route allocated: 2 of 2000; total allocated: 2 of 2000]
14:12:01.428 DEBUG [26] org.apache.http.wire - http-outgoing-1 << "[read] I/O error: Read timed out"
14:12:01.429 DEBUG [26] org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 1][route: {}->http://x.x.x.x:4441][total kept alive: 0; route allocated: 2 of 2000; total allocated: 2 of 2000]
14:12:01.429 DEBUG [26] org.apache.http.impl.execchain.MainClientExec - Stale connection check
14:12:01.430 DEBUG [26] org.apache.http.wire - http-outgoing-1 << "[read] I/O error: Read timed out"
14:12:01.430 DEBUG [26] org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-1: set socket timeout to 10800000
14:12:01.431 DEBUG [26] org.apache.http.impl.execchain.MainClientExec - Executing request GET /grid/api/proxy?id=http://x.x.x.a:5555 HTTP/1.1
14:12:01.431 DEBUG [26] org.apache.http.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
14:12:01.431 DEBUG [26] org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
14:12:01.431 DEBUG [26] org.apache.http.headers - http-outgoing-1 >> GET /grid/api/proxy?id=http://x.x.x.a:5555 HTTP/1.1
14:12:01.431 DEBUG [26] org.apache.http.headers - http-outgoing-1 >> Host: x.x.x.x:4441
14:12:01.431 DEBUG [26] org.apache.http.headers - http-outgoing-1 >> Connection: Keep-Alive
14:12:01.432 DEBUG [26] org.apache.http.headers - http-outgoing-1 >> User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_77)
14:12:01.432 DEBUG [26] org.apache.http.headers - http-outgoing-1 >> Accept-Encoding: gzip,deflate
14:12:01.432 DEBUG [26] org.apache.http.wire - http-outgoing-1 >> "GET /grid/api/proxy?id=http://x.x.x.a:5555 HTTP/1.1[\r][\n]"
14:12:01.432 DEBUG [26] org.apache.http.wire - http-outgoing-1 >> "Host: x.x.x.x:4441[\r][\n]"
14:12:01.432 DEBUG [26] org.apache.http.wire - http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
14:12:01.432 DEBUG [26] org.apache.http.wire - http-outgoing-1 >> "User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_77)[\r][\n]"
14:12:01.433 DEBUG [26] org.apache.http.wire - http-outgoing-1 >> "Accept-Encoding: gzip,deflate[\r][\n]"
14:12:01.433 DEBUG [26] org.apache.http.wire - http-outgoing-1 >> "[\r][\n]"
14:12:01.437 DEBUG [26] org.apache.http.wire - http-outgoing-1 << "HTTP/1.1 200 OK[\r][\n]"
14:12:01.437 DEBUG [26] org.apache.http.wire - http-outgoing-1 << "Date: Thu, 21 Apr 2016 12:12:01 GMT[\r][\n]"
14:12:01.437 DEBUG [26] org.apache.http.wire - http-outgoing-1 << "Content-Type: application/json; charset=UTF-8[\r][\n]"
14:12:01.437 DEBUG [26] org.apache.http.wire - http-outgoing-1 << "Content-Length: 1107[\r][\n]"
14:12:01.437 DEBUG [26] org.apache.http.wire - http-outgoing-1 << "Server: Jetty(9.2.z-SNAPSHOT)[\r][\n]"
14:12:01.437 DEBUG [26] org.apache.http.wire - http-outgoing-1 << "[\r][\n]"
14:12:01.438 DEBUG [26] org.apache.http.wire - http-outgoing-1 << "{"success":true,"msg":"proxy found !","id":"http://x.x.x.a:5555","request":{"class":"org.openqa.grid.common.RegistrationRequest","id":null,"name":null,"description":null,"configuration":{"role":"node","log":"/var/log/selenium/selenium.log","remoteHost":"http://x.x.x.a:5555","hubHost":"x.x.x.x","nodeConfig":"/opt/selenium/node.json","timeout":30000,"throwOnCapabilityNotPresent":true,"nodePolling":5000,"cleanUpCycle":5000,"Dwebdriver.chrome.driver=/opt/selenium/chromedriver_2.21/chromedriver":"","host":"x.x.x.a","browserTimeout":60000,"maxSession":10,"registerCycle":5000,"capabilityMatcher":"org.openqa.grid.internal.utils.DefaultCapabilityMatcher","debug":"","hubPort":4441,"url":"http://x.x.x.a:5555","newSessionWaitTimeout":-1,"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","hub":"http://x.x.x.x:4441","port":5555,"servlets":[],"register":true,"jettyMaxThreads":-1},"capabilities":[{"browserName":"firefox","seleniumProtocol":"WebDriver","maxInstances":4,"platform":"LINUX"},{"browserName":"chrome","seleniumProtocol":"WebDriver","maxInstances":10,"platform":"LINUX"}]}}"
14:12:01.438 DEBUG [26] org.apache.http.headers - http-outgoing-1 << HTTP/1.1 200 OK
14:12:01.438 DEBUG [26] org.apache.http.headers - http-outgoing-1 << Date: Thu, 21 Apr 2016 12:12:01 GMT
14:12:01.438 DEBUG [26] org.apache.http.headers - http-outgoing-1 << Content-Type: application/json; charset=UTF-8
14:12:01.439 DEBUG [26] org.apache.http.headers - http-outgoing-1 << Content-Length: 1107
14:12:01.439 DEBUG [26] org.apache.http.headers - http-outgoing-1 << Server: Jetty(9.2.z-SNAPSHOT)
14:12:01.439 DEBUG [26] org.apache.http.impl.execchain.MainClientExec - Connection can be kept alive indefinitely
14:12:01.439 DEBUG [26] org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection [id: 1][route: {}->http://x.x.x.x:4441] can be kept alive indefinitely
14:12:01.440 DEBUG [26] org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 1][route: {}->http://x.x.x.x:4441][total kept alive: 1; route allocated: 2 of 2000; total allocated: 2 of 2000]
14:12:01.441 DEBUG [26] org.openqa.grid.internal.utils.SelfRegisteringRemote - The node is already present on the hub. Skipping registration.


It seems that the node could not initialize a new browser (chrome) when requested. But I couldn't find the reason for this behaviour. Did someone found a solution for this problem?

⇜Krishnan Mahadevan⇝

unread,
Apr 28, 2016, 1:32:44 AM4/28/16
to Selenium Users
You could check a couple of things.

1. Is the ChromeDriver binary [ Not the Chrome browser binary ] having the required permissions that match the user permissions who is running your node ? 
2. Have you tried manually running the chromedriver binary and check if it gets invoked when called manually ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/01f19aaf-4d55-41b7-8785-abb12fccf76e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

presje...@gmail.com

unread,
Apr 28, 2016, 3:48:11 AM4/28/16
to Selenium Users
1. The ChromeDriver binary has the same permissions as the user who is starting selenium.
2. I do not know how to start the binary manually. Can you give me an example?

Just to mention it again. This error happens every X attempts, where X is a random number.

⇜Krishnan Mahadevan⇝

unread,
Apr 28, 2016, 3:55:15 AM4/28/16
to Selenium Users
Assuming that the chromedriver is already part of your PATH variable, merely typing "chromedriver" from a terminal should get it fired up.

Now that you are mentioning that this issue is sporadic and doesn't happen all the time, I am fast running out of options here.. :(

Are your tests/webdriver invocations sequential in nature ?
If they are parallel in nature then how many chrome browser instances do you spawn at a given time ? Maybe you could bring down the number of threads and see if that helps.
You could also check your code to ensure you are releasing the browser instance via driver.quit() after usage per test invocation.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

presje...@gmail.com

unread,
Apr 28, 2016, 9:10:32 AM4/28/16
to Selenium Users
I'm using selenium in a multi thread environment, and the number of threads is always -1 to the number of chrome browsers defined in the node (only one node exists).
With this I wanted to assure that when each thread creates a new RemoteWebDriver it gets a chrome instance without waiting.

The quit method for each webDriver is called in the finally block, so this shouldn't be the problem.

I have also seen that other guys have the same problem, here is the link to the issue on selenium's github.

⇜Krishnan Mahadevan⇝

unread,
Apr 28, 2016, 10:55:01 PM4/28/16
to Selenium Users
Maybe you should add a comment on that same issue with your logs etc.,

But until there's reproducible test, I doubt anything can be done. So if possible please do create a reproducible test and add it to that issue.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Reply all
Reply to author
Forward
0 new messages