Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8254967

com.sun.net.HttpsServer spins on TLS session close

XMLWordPrintable

    • b21

        The server spins sometimes (a lot on slow or underpowered servers) in SSLStreams::doClosure.

        diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java
        index 6e362d07aa4..7b44275b78f 100644
        --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java
        +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java
        @@ -430,11 +430,17 @@ class SSLStreams {
                     handshaking.lock();
                     ByteBuffer tmp = allocate(BufType.APPLICATION);
                     WrapperResult r;
        + Status st;
        + HandshakeStatus hs;
                     do {
                         tmp.clear();
                         tmp.flip ();
                         r = wrapper.wrapAndSendX (tmp, true);
        - } while (r.result.getStatus() != Status.CLOSED);
        + hs = r.result.getHandshakeStatus();
        + st = r.result.getStatus();
        + } while (st != Status.CLOSED &&
        + !(st == Status.OK
        + && hs == HandshakeStatus.NOT_HANDSHAKING));
                 } finally {
                     handshaking.unlock();
                 }

              michaelm Michael McMahon
              michaelm Michael McMahon
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: