-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
BugFor general bugs on Jetty sideFor general bugs on Jetty side
Description
Jetty version(s)
12.1.3
Jetty Environment
N/A
HTTP version
HTTP/2
Java version/vendor (use: java -version)
JDK 21
OS type/version
Linux
Description
The connection timeout does not seem to work for the HTTP/2 client.
How to reproduce?
The below code runs indefinitely without any timeout:
public static void main(String[] args) throws Exception {
ServerSocket serverTcpSocket = new ServerSocket(0); // This socket will be unresponsive
ClientConnector clientConnector = new ClientConnector();
ClientConnectionFactory.Info http1 = HttpClientConnectionFactory.HTTP11;
ClientConnectionFactory.Info http2 = new ClientConnectionFactoryOverHTTP2.HTTP2(new HTTP2Client(clientConnector));
HttpClient httpClient = new HttpClient(new HttpClientTransportDynamic(clientConnector, http1, http2));
httpClient.setConnectTimeout(1000);
httpClient.setIdleTimeout(1000);
httpClient.start();
try {
System.out.println("Attempting to connect");
httpClient.GET(URI.create("https://localhost:" + serverTcpSocket.getLocalPort())).getContent();
} catch (Exception e) {
System.out.println("Connection failed " + e);
}
}If I comment out http2, and just use the http1 connector, then it works as expected:
Attempting to connect
Connection failed java.util.concurrent.TimeoutException: Idle timeout expired: 1000/1000 ms
Metadata
Metadata
Labels
BugFor general bugs on Jetty sideFor general bugs on Jetty side
Type
Projects
Status
🏗 In progress