bonigarcia / selenium-jupiter

JUnit 5 extension for Selenium WebDriver
https://bonigarcia.dev/selenium-jupiter/
Apache License 2.0
235 stars 53 forks source link

SeleniumJupiter extension hang while trying to stop docker container #200

Closed tyge68 closed 2 years ago

tyge68 commented 3 years ago

Description of the problem: I am trying to upgrade to latest selenium-jupiter library using 4.0.1 release, but each time I run my junit test that uses the extension it now hang while trying to stop the docker container

Browser and version: docker chrome 95

Operating system: Mac OS 11.6

Selenium-Jupiter version: 4.0.1

Selenium-Jupiter use:

Selenium-Jupiter traces: 15:25:57.096 [main] INFO c.a.q.s.m.MockedAEMServer - Before ALL Warning: Nashorn engine is planned to be removed from a future JDK release 15:25:58.471 [main] INFO i.g.b.w.d.DockerService - Starting Docker container selenoid/vnc:chrome_95.0 2021-10-27 15:26:01 org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer INFO Using OpenTelemetry for tracing 2021-10-27 15:26:01 org.openqa.selenium.remote.ProtocolHandshake INFO Detected dialect: W3C 15:26:01.994 [main] INFO c.a.c.t.j.e.DingClientExtension$Store - Building client for url=http://localhost:5502/ user=admin 15:26:02.110 [main] INFO c.a.q.s.UITest - subject=http://192.168.43.29:5502/libs/grommit/core/content/login.html element=open 15:26:02.222 [main] INFO c.a.q.s.UITest - subject=http://192.168.43.29:5502/libs/grommit/core/content/login.html element=open duration=111 status=PASS error=null 15:26:02.224 [main] INFO c.a.q.s.p.Helpers - waitNetworkIdled with polling interval=250ms 15:26:02.506 [main] INFO c.a.q.s.p.Helpers - waitDocumentLoadCompleted 15:26:02.515 [main] INFO c.a.q.s.p.c.CrabReady - waitCrabReady(body) 15:26:02.643 [main] INFO c.a.q.s.p.Helpers - waitDOMIdled with polling interval=250ms 15:26:02.931 [main] INFO c.a.q.s.UITest - subject=exists() element=#Crab-collection-id-0 15:26:02.981 [main] INFO c.a.q.s.UITest - subject=exists() element=#Crab-collection-id-0 duration=50 status=PASS error=null 15:26:02.982 [main] INFO c.a.q.s.UITest - subject=set value(admin) element=#username 15:26:03.108 [main] INFO c.a.q.s.UITest - subject=set value(admin) element=#username duration=126 status=PASS error=null 15:26:03.108 [main] INFO c.a.q.s.UITest - subject=set value(admin) element=#password 15:26:03.232 [main] INFO c.a.q.s.UITest - subject=set value(admin) element=#password duration=124 status=PASS error=null 15:26:03.243 [main] INFO c.a.q.s.UITest - subject=should be(can be clicked: visible and enabled) element=#submit-button 15:26:03.283 [main] INFO c.a.q.s.UITest - subject=should be(can be clicked: visible and enabled) element=#submit-button duration=40 status=PASS error=null 15:26:04.541 [main] INFO c.a.q.s.UITest - subject=should(exist) element=#submit-button 15:26:04.571 [main] INFO c.a.q.s.UITest - subject=should(exist) element=#submit-button duration=29 status=PASS error=null 15:26:04.591 [Forwarding actions on session 3f175bc171d415a7f3c616c7201c23e3 to remote] INFO c.a.q.s.UITest - subject=get wrapped element() element=#submit-button 15:26:04.604 [Forwarding actions on session 3f175bc171d415a7f3c616c7201c23e3 to remote] INFO c.a.q.s.UITest - subject=get wrapped element() element=#submit-button duration=12 status=PASS error=null 15:26:04.791 [main] INFO c.a.q.s.p.Helpers - waitNetworkIdled with polling interval=250ms 15:26:05.065 [main] INFO c.a.q.s.p.Helpers - waitDocumentLoadCompleted 15:26:05.074 [main] INFO c.a.q.s.p.c.CrabReady - waitCrabReady(body) 15:26:05.200 [main] INFO c.a.q.s.p.Helpers - waitDOMIdled with polling interval=250ms 15:26:05.511 [main] INFO c.a.q.s.UITest - subject=http://192.168.43.29:5502/editor.html/content/some/page.html element=open 15:26:05.671 [main] INFO c.a.q.s.UITest - subject=http://192.168.43.29:5502/editor.html/content/some/page.html element=open duration=159 status=PASS error=null 15:26:05.671 [main] INFO c.a.q.s.p.EditorPage - waitPageReady 15:26:05.682 [main] INFO c.a.q.s.p.EditorPage - precondition checked 15:26:05.690 [main] INFO c.a.q.s.p.EditorPage - pageReady checked 15:26:05.775 [main] INFO c.a.q.s.u.Coverage - Coverage stored 15:26:05.785 [main] INFO c.a.q.s.u.Coverage - Coverage stored 15:26:05.794 [main] INFO c.a.q.s.j.e.JSCoverageExtension - LocalStorage JSCover detected, saved, then cleaned 15:26:05.828 [main] ERROR c.a.q.s.UITest - ================== BROWSER LOGS ======================= 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:02.246Z] [SEVERE] http://192.168.43.29:5502/favicon.ico - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.584Z] [SEVERE] http://192.168.43.29:5502/tools/foundation/clientlibs/jquery.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.584Z] [SEVERE] http://192.168.43.29:5502/tools/clientlibs/grommit/lawnchair.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.586Z] [SEVERE] http://192.168.43.29:5502/tools/foundation/clientlibs/shared.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.586Z] [SEVERE] http://192.168.43.29:5502/tools/clientlibs/grommit/Crabui2/optional/imageeditor.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.587Z] [SEVERE] http://192.168.43.29:5502/libs/clientlibs/grommit/richtext.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.590Z] [SEVERE] http://192.168.43.29:5502/libs/db/gui/components/authoring/editors/clientlibs/utils.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.590Z] [SEVERE] http://192.168.43.29:5502/libs/grommit/ui/clientlibs/annotations.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.591Z] [SEVERE] http://192.168.43.29:5502/libs/db/gui/components/authoring/editors/clientlibs/core.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.594Z] [SEVERE] http://192.168.43.29:5502/libs/db/ups/rte/plugin.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.594Z] [SEVERE] http://192.168.43.29:5502/libs/db/gui/components/authoring/searchfield/clientlibs/searchfield.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.595Z] [SEVERE] http://192.168.43.29:5502/libs/db/contentinsight/clientlibs/editor.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.613Z] [SEVERE] http://192.168.43.29:5502/tools/db/personalization/clientlib/underscore.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.613Z] [SEVERE] http://192.168.43.29:5502/tools/tsdk/handlebars.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.614Z] [SEVERE] http://192.168.43.29:5502/tools/db/personalization/clientlib/backbone.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.615Z] [SEVERE] http://192.168.43.29:5502/libs/db/gui/components/authoring/editors/clientlibs/sites/page.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.615Z] [SEVERE] http://192.168.43.29:5502/libs/db/gui/components/authoring/dialog/clientlibs/all.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.621Z] [SEVERE] http://192.168.43.29:5502/tools/clientlibs/grommit/Crabui2/optional/imageeditor.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.626Z] [SEVERE] http://192.168.43.29:5502/libs/clientlibs/grommit/richtext.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.631Z] [SEVERE] http://192.168.43.29:5502/tools/clientlibs/grommit/lawnchair.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.637Z] [SEVERE] http://192.168.43.29:5502/tools/foundation/clientlibs/jquery.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.641Z] [SEVERE] http://192.168.43.29:5502/tools/foundation/clientlibs/shared.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.646Z] [SEVERE] http://192.168.43.29:5502/libs/db/gui/components/authoring/editors/clientlibs/utils.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.650Z] [SEVERE] http://192.168.43.29:5502/libs/db/gui/components/authoring/editors/clientlibs/core.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.653Z] [SEVERE] http://192.168.43.29:5502/libs/grommit/ui/clientlibs/annotations.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.657Z] [SEVERE] http://192.168.43.29:5502/libs/db/ups/rte/plugin.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.661Z] [SEVERE] http://192.168.43.29:5502/libs/db/gui/components/authoring/searchfield/clientlibs/searchfield.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.665Z] [SEVERE] http://192.168.43.29:5502/libs/db/contentinsight/clientlibs/editor.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.668Z] [SEVERE] http://192.168.43.29:5502/tools/tsdk/handlebars.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.672Z] [SEVERE] http://192.168.43.29:5502/tools/db/personalization/clientlib/underscore.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.675Z] [SEVERE] http://192.168.43.29:5502/tools/db/personalization/clientlib/backbone.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.679Z] [SEVERE] http://192.168.43.29:5502/libs/db/gui/components/authoring/editors/clientlibs/sites/page.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.682Z] [SEVERE] http://192.168.43.29:5502/libs/db/gui/components/authoring/dialog/clientlibs/all.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) 15:26:05.828 [main] ERROR c.a.q.s.UITest - [2021-10-27T13:26:05.684Z] [SEVERE] http://192.168.43.29:5502/editor.html/content/some/page.html 466:27 Uncaught TypeError: Cannot read properties of undefined (reading 'Manager') 15:26:05.828 [main] ERROR c.a.q.s.UITest - ======================================================= 15:26:05.885 [main] INFO i.g.b.w.d.DockerService - Stopping Docker container selenoid/vnc:chrome_95.0 Error trace: No error it simply hang Thread dump: "main" #1 prio=5 os_prio=31 cpu=2693.71ms elapsed=27.41s tid=0x00007fabe3809000 nid=0x2703 runnable [0x000070000f5a6000] java.lang.Thread.State: RUNNABLE at com.github.dockerjava.transport.DomainSocket.read(Native Method) at com.github.dockerjava.transport.DomainSocket.read(DomainSocket.java:79) at com.github.dockerjava.transport.DomainSocket.access$200(DomainSocket.java:35) at com.github.dockerjava.transport.DomainSocket$DomainSocketInputStream.read(DomainSocket.java:164) at org.apache.hc.core5.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:149) at org.apache.hc.core5.http.impl.io.BHttpConnectionBase.fillInputBuffer(BHttpConnectionBase.java:265) at org.apache.hc.core5.http.impl.io.BHttpConnectionBase.isStale(BHttpConnectionBase.java:295) at org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection.isStale(DefaultBHttpClientConnection.java:67) at org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager$1.get(PoolingHttpClientConnectionManager.java:287)

tyge68 commented 3 years ago

Below is an example screenshot of what we see with VNC enabled on the docker , it seems it properly stopped the browser, but then nothing happen anymore, and the container is simply running forever

Screenshot 2021-10-27 at 16 06 39

Note I wasn't able to reproduce for example with the GenericTest which does similar actions, in our setup we use Selenide to execute our selenium actions, but as we see in the logs, those worked properly.

bonigarcia commented 3 years ago

I am not sure if this is related to the problem related to chromedriver, which has been precisely fixed for version 95. This problem has been fixed the problem in WebDriverManager, and by extension, in Selenium-Jupiter. The new versions of both projects are not released yet (I'm still on it), but you can have a try with the snapshot version, which is publicly available.

For that, you should to bump Selenium-Jupiter to 4.0.2-SNAPSHOT. This version (which contains the latest fixed) is in the sonatype snapshots repositories. If using Maven, you also need to include the following in your pom.xml:

    <repositories>
        <repository>
            <id>oss.sonatype.org-snapshot</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

... or its equivalent in Gradle:

repositories {
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

Please let me know the results with that version.

tyge68 commented 3 years ago

@bonigarcia thanks for the hint, I have tried with that, but unfortunately it still hang during the stop container with the ".read(...)" that does never seem to timeout.

tyge68 commented 3 years ago

@bonigarcia interesting is that if I do the equivalent curl command to do the stop for the given container id -> curl -F t=5 curl --unix-socket /var/run/docker.sock "http://localhost/containers/1c9fa2d07231/stop" It stop the container properly, so something is wrong in the http client that it waits on read without getting to the defined time out. Maybe a bug in the following code (1), it set a socket timeout but not a read timeout apparently, or at least that is what it looks like.

(1) https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java#L266

tyge68 commented 3 years ago

@bonigarcia it looks like I found the issue, and suggested a PR (1) on the related project, if that is accepted, it will just need an update in the webdrivermanager pom.xml to use the new version (or we can probably override it with an internal release in our pom.xml of our own IT). (1) https://github.com/docker-java/docker-java/pull/1727

bonigarcia commented 3 years ago

@tyge68 Great, I will update both WebDriverManager and Selenium-Jupiter when the new version of docker-java is available.

bonigarcia commented 2 years ago

This should be fixed in Selenium-Jupiter 4.1.0, just released.