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

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

    Details

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  martin Martin Buchholz
                  Reporter:
                  dholmes David Holmes
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: