docker-selenium icon indicating copy to clipboard operation
docker-selenium copied to clipboard

[🐛 Bug]: selenium standalone-chrome kind of crashed after some user error

Open TomXRX opened this issue 3 years ago • 4 comments

What happened?

I made some request by python after I called driver.quit() Then a selenium.common.exceptions.WebDriverException is thrown. Then I cannot make another request to the selenium hub by python. Function "webdriver.Remote()" just hangs.

That's the confusing error logs that is too long for me to really understand them. image image

I opened "http://localhost:4444/" using novnc connection, the queue is empty but everything else appears to be loading. image

I checked "http://chrome:4444/status" and all slots were empty.

I have to restart the whole container of selenium hub in order to make things working again.

Command used to start Selenium Grid with Docker

d=webdriver.Remote("http://chrome:4444/wd/hub")
d.get("http://localhost:7900")
clip=d.find_element(value="noVNC_clipboard_text")
d.quit()
clip.get_attribute("value")
#then the exception throws

#and also I need a better way to get things from chrome clipboard

Relevant log output

23:53:46.665 WARN [SpanWrappedHttpHandler.execute] - Unable to execute request: Expected to read a START_MAP but instead have: END. Last 0 characters read:
chrome_1    | Build info: version: '4.3.0', revision: 'a4995e2c09*'
chrome_1    | System info: host: '6521346ca6b6', ip: '192.168.48.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.102.1-microsoft-standard-WSL2', java.version: '11.0.15'
chrome_1    | Driver info: driver.version: unknown
chrome_1    | org.openqa.selenium.json.JsonException: Expected to read a START_MAP but instead have: END. Last 0 characters read:
chrome_1    | Build info: version: '4.3.0', revision: 'a4995e2c09*'
chrome_1    | System info: host: '6521346ca6b6', ip: '192.168.48.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.102.1-microsoft-standard-WSL2', java.version: '11.0.15'
chrome_1    | Driver info: driver.version: unknown
chrome_1    |   at org.openqa.selenium.json.JsonInput.expect(JsonInput.java:307)
chrome_1    |   at org.openqa.selenium.json.JsonInput.beginObject(JsonInput.java:229)
chrome_1    |   at org.openqa.selenium.remote.NewSessionPayload.getOss(NewSessionPayload.java:306)
chrome_1    |   at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:84)
chrome_1    |   at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:118)
chrome_1    |   at org.openqa.selenium.grid.data.SessionRequest.<init>(SessionRequest.java:65)
chrome_1    |   at org.openqa.selenium.grid.sessionqueue.NewSessionQueue.lambda$new$0(NewSessionQueue.java:66)
chrome_1    |   at org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.grid.sessionqueue.NewSessionQueue.execute(NewSessionQueue.java:120)
chrome_1    |   at org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:86)
chrome_1    |   at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
chrome_1    |   at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.grid.router.Router.execute(Router.java:91)
chrome_1    |   at org.openqa.selenium.grid.web.EnsureSpecCompliantResponseHeaders.lambda$apply$0(EnsureSpecCompliantResponseHeaders.java:34)
chrome_1    |   at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
chrome_1    |   at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.remote.http.Route$NestedRoute.handle(Route.java:270)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)
chrome_1    |   at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
chrome_1    |   at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
chrome_1    |   at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
chrome_1    |   at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
chrome_1    |   at org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)
chrome_1    |   at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
chrome_1    |   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
chrome_1    |   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
chrome_1    |   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
chrome_1    |   at java.base/java.lang.Thread.run(Thread.java:829)
chrome_1    | 23:53:46.666 WARN [SeleniumSpanExporter$1.lambda$export$1] - Unable to execute request: Expected to read a START_MAP but instead have: END. Last 0 characters read:
chrome_1    | Build info: version: '4.3.0', revision: 'a4995e2c09*'
chrome_1    | System info: host: '6521346ca6b6', ip: '192.168.48.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.102.1-microsoft-standard-WSL2', java.version: '11.0.15'
chrome_1    | Driver info: driver.version: unknown
chrome_1    | 23:53:46.666 WARN [SeleniumSpanExporter$1.lambda$export$1] - org.openqa.selenium.json.JsonException: Expected to read a START_MAP but instead have: END. Last 0 characters read:
chrome_1    | Build info: version: '4.3.0', revision: 'a4995e2c09*'
chrome_1    | System info: host: '6521346ca6b6', ip: '192.168.48.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.102.1-microsoft-standard-WSL2', java.version: '11.0.15'
chrome_1    | Driver info: driver.version: unknown
chrome_1    |   at org.openqa.selenium.json.JsonInput.expect(JsonInput.java:307)
chrome_1    |   at org.openqa.selenium.json.JsonInput.beginObject(JsonInput.java:229)
chrome_1    |   at org.openqa.selenium.remote.NewSessionPayload.getOss(NewSessionPayload.java:306)
chrome_1    |   at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:84)
chrome_1    |   at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:118)
chrome_1    |   at org.openqa.selenium.grid.data.SessionRequest.<init>(SessionRequest.java:65)
chrome_1    |   at org.openqa.selenium.grid.sessionqueue.NewSessionQueue.lambda$new$0(NewSessionQueue.java:66)
chrome_1    |   at org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.grid.sessionqueue.NewSessionQueue.execute(NewSessionQueue.java:120)
chrome_1    |   at org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:86)
chrome_1    |   at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
chrome_1    |   at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.grid.router.Router.execute(Router.java:91)
chrome_1    |   at org.openqa.selenium.grid.web.EnsureSpecCompliantResponseHeaders.lambda$apply$0(EnsureSpecCompliantResponseHeaders.java:34)
chrome_1    |   at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
chrome_1    |   at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.remote.http.Route$NestedRoute.handle(Route.java:270)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
chrome_1    |   at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
chrome_1    |   at org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)
chrome_1    |   at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
chrome_1    |   at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
chrome_1    |   at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
chrome_1    |   at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
chrome_1    |   at org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)
chrome_1    |   at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
chrome_1    |   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
chrome_1    |   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
chrome_1    |   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
chrome_1    |   at java.base/java.lang.Thread.run(Thread.java:829)
chrome_1    |
chrome_1    | 23:53:46.666 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "c7646669c0a1673dd92f2b6821b56190","eventTime": 1656518026665517312,"eventName": "exception","attributes": {"exception.message": "Unable to execute request: Expected to read a START_MAP but instead have: END. Last 0 characters read: \nBuild info: version: '4.3.0', revision: 'a4995e2c09*'\nSystem info: host: '6521346ca6b6', ip: '192.168.48.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.102.1-microsoft-standard-WSL2', java.version: '11.0.15'\nDriver info: driver.version: unknown","exception.stacktrace": "org.openqa.selenium.json.JsonException: Expected to read a START_MAP but instead have: END. Last 0 characters read: \nBuild info: version: '4.3.0', revision: 'a4995e2c09*'\nSystem info: host: '6521346ca6b6', ip: '192.168.48.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.102.1-microsoft-standard-WSL2', java.version: '11.0.15'\nDriver info: driver.version: unknown\n\tat org.openqa.selenium.json.JsonInput.expect(JsonInput.java:307)\n\tat org.openqa.selenium.json.JsonInput.beginObject(JsonInput.java:229)\n\tat org.openqa.selenium.remote.NewSessionPayload.getOss(NewSessionPayload.java:306)\n\tat org.openqa.selenium.remote.NewSessionPayload.\u003cinit>(NewSessionPayload.java:84)\n\tat org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:118)\n\tat org.openqa.selenium.grid.data.SessionRequest.\u003cinit>(SessionRequest.java:65)\n\tat org.openqa.selenium.grid.sessionqueue.NewSessionQueue.lambda$new$0(NewSessionQueue.java:66)\n\tat org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.grid.sessionqueue.NewSessionQueue.execute(NewSessionQueue.java:120)\n\tat org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:86)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.grid.router.Router.execute(Router.java:91)\n\tat org.openqa.selenium.grid.web.EnsureSpecCompliantResponseHeaders.lambda$apply$0(EnsureSpecCompliantResponseHeaders.java:34)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.http.Route$NestedRoute.handle(Route.java:270)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)\n\tat java.base\u002fjava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\n\tat java.base\u002fjava.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base\u002fjava.lang.Thread.run(Thread.java:829)\n","exception.type": "org.openqa.selenium.json.JsonException","http.flavor": 1,"http.handler_class": "org.openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue","http.host": "chrome:4444","http.method": "POST","http.request_content_length": "425","http.scheme": "HTTP","http.target": "\u002fsession","http.user_agent": "selenium\u002f4.2.0 (python linux)"}}

Operating System

Windows11 WSL

Docker Selenium version (tag)

selenium/standalone-chrome:4.3.0-20220624

TomXRX avatar Jun 29 '22 16:06 TomXRX

How are you starting the Grid? Just a bit confused because in some parts you reference localhost and in others chrome.

diemol avatar Jun 29 '22 19:06 diemol

How are you starting the Grid? Just a bit confused because in some parts you reference localhost and in others chrome.

using docker-compose.yml

version: "3" services: chrome: image: selenium/standalone-chrome:4.3.0-20220624 user: root volumes: - /mnt/h:/file ports: - "7000:7900" shm_size: 4gb

notebook: image: toms/selenium_notebook command: jupyter lab --NotebookApp.token=some_password ports: - "9961:8888" volumes: - .:/home/jovyan/work - /mnt/h:/home/jovyan/file links: - "chrome"

I call it localhost because the url is called inside the standalone-chrome container. And I call it "chrome" when I access it from my jupyter notebook. It should be the same thing.

TomXRX avatar Jun 30 '22 15:06 TomXRX

I have encountered the same situation. However, I am running a docker container locally with the tag "standalone-chromium:110.0.5481.77-chromedriver-110.0.5481.77". After being idle with no connections or requests for about 1-2 hours, the container becomes unresponsive and I am unable to connect. When I check it using a web browser, it displays the same loading screen as shown in the screenshot above. The only way to restore it is to restart the container. Almost every 1-2 hours, I have to restart the container.

wqsacy avatar Mar 07 '23 01:03 wqsacy

I have encountered the same situation. However, I am running a docker container locally with the tag "standalone-chromium:110.0.5481.77-chromedriver-110.0.5481.77". After being idle with no connections or requests for about 1-2 hours, the container becomes unresponsive and I am unable to connect. When I check it using a web browser, it displays the same loading screen as shown in the screenshot above. The only way to restore it is to restart the container. Almost every 1-2 hours, I have to restart the container.

@wqsacy did you ever find a solution? running into same problem on Azure VM

willb0 avatar Feb 15 '24 16:02 willb0