Selenium: Selenium fails to launch when running on a single cpu

Created on 1 Nov 2018  路  11Comments  路  Source: SeleniumHQ/selenium

Hi all,

After the recent update to v3.141.0 I've found that Selenium throws an exception when run on a single cpu.

During our CI process, I'm trying to run Protractor's webdriver-manager tool which depends on Selenium. To use it you typically run webdriver-manager update to get the latest drivers, e.g. Selenium, Chromedriver, etc. Then you run webdriver-manager start, which launches Selenium and Chromedriver etc.

The problem looks to happen during Jetty setup, in 'selenium/java/server/src/org/openqa/selenium/grid/server/BaseServerOptions.java' ln.61 where the max threads is set to 3 for single cpu systems

Meta -

OS: Fedora Linux
Selenium Version: 3.141.0
Browser: N/A
Browser Version: N/A

Expected Behavior -

Selenium starts normally when run on a single cpu

Actual Behavior -

Selenium throws an exception when run on a single cpu

Steps to reproduce -

Launch selenium on a system with a single cpu (we're using a vm), it should throw the following exception:

Exception in thread "main" java.lang.IllegalStateException: Insufficient configured threads: required=3 < max=3 for QueuedThreadPool[qtp707610042]@2a2d45ba{STARTED,3<=3<=3,i=3,q=0}[ReservedThreadExecutor@2f7c2f4f{s=0/1,p=0}]

The exception goes away when increasing the number of cpu's

Full output from webdriver-manager start:

$ webdriver-manager start
[09:11:55] I/start - java -Djava.security.egd=file:///dev/./urandom -Dwebdriver.chrome.driver=/usr/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.43 -Dwebdriver.gecko.driver=/usr/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.23.0 -jar /usr/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.0.jar -port 4444
[09:11:55] I/start - seleniumProcess.pid: 16354
09:11:56.047 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.0, revision: 2ecb7d9a
09:11:56.240 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2018-11-01 09:11:56.350:INFO::main: Logging initialized @853ms to org.seleniumhq.jetty9.util.log.StdErrLog
09:11:56.819 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
Exception in thread "main" java.lang.IllegalStateException: Insufficient configured threads: required=3 < max=3 for QueuedThreadPool[qtp707610042]@2a2d45ba{STARTED,3<=3<=3,i=3,q=0}[ReservedThreadExecutor@2f7c2f4f{s=0/1,p=0}]
at org.seleniumhq.jetty9.util.thread.ThreadPoolBudget.check(ThreadPoolBudget.java:155)
at org.seleniumhq.jetty9.util.thread.ThreadPoolBudget.leaseTo(ThreadPoolBudget.java:129)
at org.seleniumhq.jetty9.util.thread.ThreadPoolBudget.leaseFrom(ThreadPoolBudget.java:181)
at org.seleniumhq.jetty9.io.SelectorManager.doStart(SelectorManager.java:255)
at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.seleniumhq.jetty9.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
at org.seleniumhq.jetty9.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)
at org.seleniumhq.jetty9.server.AbstractConnector.doStart(AbstractConnector.java:282)
at org.seleniumhq.jetty9.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:81)
at org.seleniumhq.jetty9.server.ServerConnector.doStart(ServerConnector.java:235)
at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.seleniumhq.jetty9.server.Server.doStart(Server.java:395)
at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.openqa.selenium.grid.server.BaseServer.start(BaseServer.java:193)
at org.openqa.selenium.remote.server.SeleniumServer.boot(SeleniumServer.java:137)
at org.openqa.grid.selenium.GridLauncherV3.lambda$buildLaunchers$3(GridLauncherV3.java:249)
at org.openqa.grid.selenium.GridLauncherV3.lambda$launch$0(GridLauncherV3.java:86)
at java.util.Optional.map(Optional.java:215)
at org.openqa.grid.selenium.GridLauncherV3.launch(GridLauncherV3.java:86)
at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:70)
[09:28:54] I/start - Staying alive until the Selenium Standalone process exits
[09:28:54] I/start - Selenium Standalone has exited with code 130
C-grid R-awaiting answer

Most helpful comment

3.141.5 has now been released, with this fix in. Share and enjoy!

All 11 comments

I can confirm the issue in my Windows VM also running on a single core...

I can confirm this issue is occurring on CentOS with a single core.

Same issue is occurring when I try to run it in the docker container that has single CPU

@AndrewFinlay @adrianer @Twb3 @milindm24
does this only happen when using the webdriver-manager command? Or also when starting it through java -jar ...?

@AndrewFinlay @adrianer @Twb3 @milindm24
does this only happen when using the webdriver-manager command? Or also when starting it through java -jar ...?

it happens for both

@milindm24 could you please post the command used to start the docker container?

This is happening for me as well, in Gitlab's CI. Unfortunately, I don't have many details since they abstract out a lot. I opened a support ticket here: https://forum.gitlab.com/t/insufficient-configured-threads-selenium-standalone-chrome/20594

@milindm24 could you please post the command used to start the docker container?

@diemol I have the same error using the command from the docker-selenium README:

sudo docker run -d --net grid -e HUB_HOST=selenium-hub -v /dev/shm:/dev/shm selenium/node-firefox:3.141.0-actinium

This should be fixed by d54ebd709a3454e94c2a137c1b06d20f92a73784. We're preparing a new release with this fix in.

3.141.5 has now been released, with this fix in. Share and enjoy!

Thanks for the fix, @shs96c! Tests are running again :)

Was this page helpful?
0 / 5 - 0 ratings