-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
11.0.10
-
x86_64
-
windows_10
ADDITIONAL SYSTEM INFORMATION :
Windows 10, Java 11.0.10
A DESCRIPTION OF THE PROBLEM :
When client (at least VLC media player) doesn't wait for incoming stream to finish, server thread is deadlocked in doClosure() function forever with high CPU usage
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Server init:
SSLContext sslContext = SSLContext.getInstance("TLS");
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(trustStore, password);
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
tmf.init(trustStore);
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
HttpsServer server = HttpsServer.create();
server.setHttpsConfigurator(new HttpsConfigurator(sslContext) {
public void configure(HttpsParameters params) {
try {
SSLContext c = SSLContext.getDefault();
SSLEngine engine = c.createSSLEngine();
params.setNeedClientAuth(false);
params.setCipherSuites(engine.getEnabledCipherSuites());
params.setProtocols(engine.getEnabledProtocols());
SSLParameters defaultSSLParameters = c.getDefaultSSLParameters();
params.setSSLParameters(defaultSSLParameters);
} catch (Exception ex) {
}
}
});
server.bind(new InetSocketAddress(8080, 0);
ExecutorService executor = Executors.newFixedThreadPool(30);
server.setExecutor(executor);
Context code:
exchange.sendResponseHeaders(200, srcFile.length());
Files.copy(srcFile.toPath(), exchange.getResponseBody());
exchange.getResponseBody().flush();
exchange.getResponseBody().close();
ACTUAL -
Each new connection, that is initiated by client before waiting for previous file to transmit, causes deadlock in doClosure with r.result = OK forever, even after client is disconnected long time ago
void doClosure () throws IOException {
try {
handshaking.lock();
ByteBuffer tmp = allocate(BufType.APPLICATION);
WrapperResult r;
do {
tmp.clear();
tmp.flip ();
r = wrapper.wrapAndSendX (tmp, true);
} while (r.result.getStatus() != Status.CLOSED);
} finally {
handshaking.unlock();
}
}
CUSTOMER SUBMITTED WORKAROUND :
jdk.tls.disabledAlgorithms=TLSv1.3 same workaround as forJDK-8241054
FREQUENCY : always
Windows 10, Java 11.0.10
A DESCRIPTION OF THE PROBLEM :
When client (at least VLC media player) doesn't wait for incoming stream to finish, server thread is deadlocked in doClosure() function forever with high CPU usage
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Server init:
SSLContext sslContext = SSLContext.getInstance("TLS");
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(trustStore, password);
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
tmf.init(trustStore);
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
HttpsServer server = HttpsServer.create();
server.setHttpsConfigurator(new HttpsConfigurator(sslContext) {
public void configure(HttpsParameters params) {
try {
SSLContext c = SSLContext.getDefault();
SSLEngine engine = c.createSSLEngine();
params.setNeedClientAuth(false);
params.setCipherSuites(engine.getEnabledCipherSuites());
params.setProtocols(engine.getEnabledProtocols());
SSLParameters defaultSSLParameters = c.getDefaultSSLParameters();
params.setSSLParameters(defaultSSLParameters);
} catch (Exception ex) {
}
}
});
server.bind(new InetSocketAddress(8080, 0);
ExecutorService executor = Executors.newFixedThreadPool(30);
server.setExecutor(executor);
Context code:
exchange.sendResponseHeaders(200, srcFile.length());
Files.copy(srcFile.toPath(), exchange.getResponseBody());
exchange.getResponseBody().flush();
exchange.getResponseBody().close();
ACTUAL -
Each new connection, that is initiated by client before waiting for previous file to transmit, causes deadlock in doClosure with r.result = OK forever, even after client is disconnected long time ago
void doClosure () throws IOException {
try {
handshaking.lock();
ByteBuffer tmp = allocate(BufType.APPLICATION);
WrapperResult r;
do {
tmp.clear();
tmp.flip ();
r = wrapper.wrapAndSendX (tmp, true);
} while (r.result.getStatus() != Status.CLOSED);
} finally {
handshaking.unlock();
}
}
CUSTOMER SUBMITTED WORKAROUND :
jdk.tls.disabledAlgorithms=TLSv1.3 same workaround as for
FREQUENCY : always
- duplicates
-
JDK-8254967 com.sun.net.HttpsServer spins on TLS session close
- Resolved
- relates to
-
JDK-8254967 com.sun.net.HttpsServer spins on TLS session close
- Resolved