0

We are continuously facing browser timeout issues in Selenium Grid. The occurence is intermittent. We are not able to find the reasoning.

If anybody has any idea, it would be of great help.

Selenium Jar: 3.14.0 chromedriver: 2.41 Appium: 1.8.1 java_client: 5.0.4

[INFO ] 17:01:15.145 com.ytlctest.e2evalidation.pagefunctions.DaoPageFuncs.loginPage() - Login to WOM
[INFO ] 17:01:15.145 com.ytlctest.lib.MainUtil.launchURL() - Launching the URL
[ERROR] 17:01:15.161 com.ytlctest.lib.MainUtil.launchURL() - Text not typed
[ERROR] 17:01:15.162 com.ytlctest.lib.MainUtil.launchURL() - EXCEPTIONTEXTMETHOD launchURL
org.openqa.selenium.WebDriverException: Session [4c1df58d0fbcc5da00e18fe779040941] was terminated due to TIMEOUT
Command duration or timeout: 0 milliseconds
    at sun.reflect.GeneratedConstructorAccessor28.newInstance(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214) ~[selenium-remote-driver-3.14.0.jar:?]
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166) ~[selenium-remote-driver-3.14.0.jar:?]
    at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40) ~[selenium-remote-driver-3.14.0.jar:?]
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80) ~[selenium-remote-driver-3.14.0.jar:?]
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44) ~[selenium-remote-driver-3.14.0.jar:?]
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) ~[selenium-remote-driver-3.14.0.jar:?]
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) ~[selenium-remote-driver-3.14.0.jar:?]
    at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:276) ~[selenium-remote-driver-3.14.0.jar:?]
    at com.ytlctest.lib.MainUtil.launchURL(MainUtil.java:78) [selfra-0.0.32.jar:?]
    at com.ytlctest.e2evalidation.pagefunctions.DaoPageFuncs.loginPage(DaoPageFuncs.java:39) [selfra-0.0.32.jar:?]
    at com.ytlctest.e2evalidation.WOMAutomation.runWomTest(WOMAutomation.java:48) [selfra-0.0.32.jar:?]
    at com.ytlctest.myyes4g.testCases.myyes4gPostpaidAddon.postpaidAddonPurchase(myyes4gPostpaidAddon.java:78) [classes/:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) [testng-6.14.3.jar:?]
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:583) [testng-6.14.3.jar:?]
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719) [testng-6.14.3.jar:?]
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989) [testng-6.14.3.jar:?]
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) [testng-6.14.3.jar:?]
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) [testng-6.14.3.jar:?]
    at org.testng.TestRunner.privateRun(TestRunner.java:648) [testng-6.14.3.jar:?]
    at org.testng.TestRunner.run(TestRunner.java:505) [testng-6.14.3.jar:?]
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) [testng-6.14.3.jar:?]
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) [testng-6.14.3.jar:?]
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) [testng-6.14.3.jar:?]
    at org.testng.SuiteRunner.run(SuiteRunner.java:364) [testng-6.14.3.jar:?]
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) [testng-6.14.3.jar:?]
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) [testng-6.14.3.jar:?]
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) [testng-6.14.3.jar:?]
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) [testng-6.14.3.jar:?]
    at org.testng.TestNG.runSuites(TestNG.java:1049) [testng-6.14.3.jar:?]
    at org.testng.TestNG.run(TestNG.java:1017) [testng-6.14.3.jar:?]
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:283) [surefire-testng-2.21.0.jar:2.21.0]
    at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75) [surefire-testng-2.21.0.jar:2.21.0]
    at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120) [surefire-testng-2.21.0.jar:2.21.0]
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:379) [surefire-booter-2.21.0.jar:2.21.0]
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:340) [surefire-booter-2.21.0.jar:2.21.0]
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125) [surefire-booter-2.21.0.jar:2.21.0]
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:413) [surefire-booter-2.21.0.jar:2.21.0]
Caused by: org.openqa.selenium.WebDriverException: Session [4c1df58d0fbcc5da00e18fe779040941] was terminated due to TIMEOUT
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'SN2YCVW1B0003', ip: '10.10.1.248', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_181'
Driver info: driver.version: unknown
    at org.openqa.grid.internal.ActiveTestSessions.getExistingSession(ActiveTestSessions.java:115) ~[?:?]
    at org.openqa.grid.internal.DefaultGridRegistry.getExistingSession(DefaultGridRegistry.java:379) ~[?:?]
    at org.openqa.grid.web.servlet.handler.RequestHandler.getSession(RequestHandler.java:241) ~[?:?]
    at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:123) ~[?:?]
    at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:85) ~[?:?]
    at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:69) ~[?:?]
    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:860) ~[?:?]
    at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535) ~[?:?]
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[?:?]
    at org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548) ~[?:?]
    at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[?:?]
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190) ~[?:?]
    at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595) ~[?:?]
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) ~[?:?]
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) ~[?:?]
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) ~[?:?]
    at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473) ~[?:?]
    at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564) ~[?:?]
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) ~[?:?]
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155) ~[?:?]
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[?:?]
    at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[?:?]
    at org.seleniumhq.jetty9.server.Server.handle(Server.java:530) ~[?:?]
    at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:347) ~[?:?]
    at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:256) ~[?:?]
    at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) ~[?:?]
    at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:102) ~[?:?]
    at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) ~[?:?]
    at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247) ~[?:?]
    at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140) ~[?:?]
    at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) ~[?:?]
    at org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382) ~[?:?]
    at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708) ~[?:?]
    at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626) ~[?:?]
    at java.lang.Thread.run(Unknown Source) ~[?:1.8.0_181]

hub.json

java -jar selenium-server-standalone-3.14.0.jar -role hub -browserTimeout 120000 -port 4545

{
  "host": "10.28.19.251",
  "port": 4545,
  "newSessionWaitTimeout": -1,
  "servlets" : [],
  "prioritizer": null,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "nodePolling": 5000,
  "cleanUpCycle": 5000,
  "timeout": 30000,
  "browserTimeout": 120000,
  "maxSession": 5,
  "jettyMaxThreads": 10
}

Node.json

java -jar selenium-server-standalone-3.14.0.jar -role node -browserTimeout 120000 -hub http://10.28.19.251:4545/grid/register

{
  "capabilities":
  [
    {
      "webdriver.chrome.driver": "C:/seleniumserver/chromedriver.exe",
      "browserName": "chrome",
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver",
      "version": 2.41
    }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "maxSession": 5,
  "port": 4502,
  "host": "127.0.0.1",
  "register": true,
  "registerCycle": 5000,
  "hub": "http://10.28.19.251:4545",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "browserTimeout": "120000",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": false,
  "servlets" : [],
  "withoutServlets": [],
  "custom": {}
}
Prakash P
  • 419
  • 1
  • 8
  • 18
  • I have found solution for this error if we use driver.quit() in our scripts then this error will go. [link](https://stackoverflow.com/questions/40805828/in-jenkins-haedless-browser-org-openqa-selenium-webdriverexception-error-commu) – bhupathi turaga Aug 16 '18 at 09:53
  • Update the question with the _Hub_ and _Node_ initiation commands and trace logs as well as the complete error trace log. – undetected Selenium Aug 16 '18 at 10:05
  • @DebanjanB I have done that. Please help! – Prakash P Aug 16 '18 at 10:14

1 Answers1

1

It depends a lot on selenium grid configuration.As visible in your config json, you have used the property maxSession please change it to maxInstances. you should not limit max sessions on your grid. Even if you want to keep this property make it something like 1000 or so.

Also eliminate the property newSessionWaitTimeout. Lets use the default configured value.

Since we understand that the only issue with using selenium grid is maintainance as it needs regular restarts on hub and node basis. I would suggest to use some third party wrappers for better and easy maintainance. You can try SeleniumGridExtras by groupon.

Abhishek_Mishra
  • 4,551
  • 4
  • 25
  • 38
  • 1 requests waiting for a slot to be free. Capabilities {appActivity: my.yes.myyes4g.HomeActivity, appPackage: my.yes.yes4g, appWaitDuration: 60, autoGrantPermissions: true, browserName: android, clearSystemFiles: true, deviceName: Altitude, fullReset: false, newCommandTimeout: 60, noReset: true, noSign: true, platform: ANDROID, platformName: android, version: } Config for the hub : browserTimeout : 120 debug : false – Prakash P Aug 17 '18 at 11:43
  • It keeps saying this now. Can you please help. – Prakash P Aug 17 '18 at 11:44
  • Please update the configs and recent error in question. Its difficult to understand the current config in comment. – Abhishek_Mishra Aug 17 '18 at 13:49
  • It got solved now. maxInstances was set to 1. Increased it to 5. Then this error went off. Thank you. – Prakash P Aug 20 '18 at 01:59
  • what is the reason ? 'm facing this issue now. How did the changing that property resolved it. – gaurav kumar Jan 24 '20 at 12:59