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

httpserver does not close connections when RejectedExecutionException occurs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 11
    • 8, 9
    • core-libs
    • b04
    • generic
    • generic
    • Verified

      com.sun.net.httpserver does not catch
      RejectedExecutionException and it does not close connections. We must
      catch this exception to close a socket.


      * steps to reproduce with attached files
       1. java -Djava.util.logging.config.file=logging.properties SmallHttpServer
       2. post tcp connections by curl or other ways
           e.g.: while true; do curl -XPOST --noproxy 127.0.0.1
      http://127.0.0.1:8080/; done
       3. wait RejectedExecutionException occurs as below and then
      SmallHttpServer stops by this issue.
      ----
      Nov 05, 2016 12:01:48 PM sun.net.httpserver.ServerImpl$Dispatcher run
      FINER: Dispatcher (7)
      java.util.concurrent.RejectedExecutionException: Task
      sun.net.httpserver.ServerImpl$Exchange@37b50d9e rejected from
      java.util.concurrent.ThreadPoolExecutor@1b3178d4[Running, pool size =
      1, active threads = 0, queued tasks = 0, completed tasks = 7168]
              at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(java.base/ThreadPoolExecutor.java:2076)
              at java.util.concurrent.ThreadPoolExecutor.reject(java.base/ThreadPoolExecutor.java:842)
              at java.util.concurrent.ThreadPoolExecutor.execute(java.base/ThreadPoolExecutor.java:1388)
              at sun.net.httpserver.ServerImpl$Dispatcher.handle(jdk.httpserver/ServerImpl.java:440)
              at sun.net.httpserver.ServerImpl$Dispatcher.run(jdk.httpserver/ServerImpl.java:405)
              at java.lang.Thread.run(java.base/Thread.java:844)
      (SmallHttpServer is stopping by not closing socket)

            chegar Chris Hegarty
            ykubota Yuji KUBOTA
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: