Skip to content

[🐛 Bug]: Memory leak running hub, due to HttpClient-x-SelectorManager threads never closed #13246

Closed as not planned
@bhecquet

Description

@bhecquet

What happened?

Hello

On our hub (version 4.15.0, JDK 11.0.20), running 13 nodes, memory increase continuously as tests run. Attaching a VisualVM shows that it seems to be caused by an increasing number of HttpClient-x-SelectorManager threads that are not closed (seems similar to #12206 or #11336)

Operations are normal, except when max memory is reached. In this case, hub does not respond anymore
image

In the graphic above, you can see that 300 more threads have been created in an hour

Is there a way (to help) to track down the creator of the staled threads ? Thread dump doesn't help much


"HttpClient-111-SelectorManager" - Thread t@756
   java.lang.Thread.State: RUNNABLE
        at java.base@11.0.20.1/sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
        at java.base@11.0.20.1/sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:357)
        at java.base@11.0.20.1/sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:182)
        at java.base@11.0.20.1/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:124)
        - locked <2eebf6a6> (a sun.nio.ch.Util$2)
        - locked <4a436b2f> (a sun.nio.ch.WindowsSelectorImpl)
        at java.base@11.0.20.1/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:136)
        at platform/java.net.http@11.0.20.1/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:867)

   Locked ownable synchronizers:
        - None

Thanks

How can we reproduce the issue?

Start a hub
Start some nodes
Execute many tests. I think the more tests are run, the easier it's to point the issue

Relevant log output

no relevant logs available on hub

Operating System

Windows / Linux

Selenium version

4.11.0

What are the browser(s) and version(s) where you see this issue?

any browser

What are the browser driver(s) and version(s) where you see this issue?

any browser

Are you using Selenium Grid?

4.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-gridEverything grid and server relatedI-defectSomething is not working as intendedJ-awaiting answerQuestion asked of user; a reply moves it to triage again

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions