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

ThreadPoolExecutor: Thread.isAlive() is not equivalent to not being startable

XMLWordPrintable

        As referenced by Thomas Stuefe in:

        http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2019-April/033512.html

        ThreadPoolExecutor.addWorker has:

         if (t.isAlive()) // precheck that t is startable
                 throw new IllegalThreadStateException();

        but that is not a sufficient check for being "startable" as a thread that has already terminated is "not alive". If such a thread is then "started" the code will throw IllegalThreadStateException without doing proper cleanup of the worker list.

              martin Martin Buchholz
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: