Skip to content

[🐛 Bug]: JdkHttpClient does prevent process to terminate promptly #13601

Closed
@joerg1985

Description

@joerg1985

What happened?

When the JdkHttpClient is e.g. used in a main method it will prevent the process to terminate for 60s.

The threads created by JdkHttpClient.executorService should be daemon threads to avoid this.

How can we reproduce the issue?

import java.net.URI;
import org.openqa.selenium.remote.http.ClientConfig;
import org.openqa.selenium.remote.http.HttpMethod;
import org.openqa.selenium.remote.http.HttpRequest;
import org.openqa.selenium.remote.http.jdk.JdkHttpClient;

public class KeepsRunning {
    public static void main(String[] args) {
        var c = new JdkHttpClient.Factory().createClient(ClientConfig.defaultConfig()
                .baseUri(URI.create("http://127.0.0.1:4444")));
        
        c.execute(new HttpRequest(HttpMethod.GET, "http://127.0.0.1:4444"));
    }
}

Relevant log output

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time:  01:02 min
Finished at: 2024-02-19T12:39:34+01:00
------------------------------------------------------------------------

Operating System

win 10 x64

Selenium version

4.17.0

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

N/A

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

N/A

Are you using Selenium Grid?

no

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-javaJava BindingsI-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions