Skip to content
Permalink
Browse files

8236596: HttpClient leaves HTTP/2 sockets in CLOSE_WAIT, when using p…

…roxy tunnel

Changes Http2ClientImpl::stop to close the TCP connection after sending out the GOAWAY frame.

Reviewed-by: chegar
  • Loading branch information
dfuch committed Jan 24, 2020
1 parent 4fdcb47 commit 9085b7bdc7757a5e29d841beddc4d235bbf5887b
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java
@@ -25,6 +25,7 @@

package jdk.internal.net.http;

import java.io.EOFException;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.ConnectException;
@@ -186,14 +187,18 @@ void deleteConnection(Http2Connection c) {
}
}

private EOFException STOPPED;
void stop() {
if (debug.on()) debug.log("stopping");
STOPPED = new EOFException("HTTP/2 client stopped");
STOPPED.setStackTrace(new StackTraceElement[0]);
connections.values().forEach(this::close);
connections.clear();
}

private void close(Http2Connection h2c) {
try { h2c.close(); } catch (Throwable t) {}
try { h2c.shutdown(STOPPED); } catch (Throwable t) {}
}

HttpClientImpl client() {

0 comments on commit 9085b7b

Please sign in to comment.