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

com.sun.net.httpserver.HttpServer: Sending the response headers before draining the request body can cause AssertionError

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • tbd
    • None
    • core-libs
    • None

      If a custom HttpHandler calls HttpExchange.sendResponseHeaders() followed by HttpExchange.close() without first calling HttpExchange.getRequestBody().readAllBytes(), an assertion error may occur:

      java.lang.AssertionError
      at jdk.httpserver/sun.net.httpserver.ServerImpl.responseCompleted(ServerImpl.java:805)
      at jdk.httpserver/sun.net.httpserver.ServerImpl$Dispatcher.handleEvent(ServerImpl.java:293)
      at jdk.httpserver/sun.net.httpserver.ServerImpl$Dispatcher.run(ServerImpl.java:352)
      at java.base/java.lang.Thread.run(Thread.java:844)

      If assertions are not enabled, the server may close the channel even though keep-alive was requested, which may cause performance drops (or authentication failures for authentication scheme like NTLM/Negotiate where the server needs two trips authentication and expects the second message to come from the same channel).

            dfuchs Daniel Fuchs
            dfuchs Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: