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

ThreadPoolExecutor leak

XMLWordPrintable

    • b81
    • x86
    • linux_redhat_9.0
    • Verified

      If you create a singlethreaded executor, submit a single task into it and forget its reference, both the ThreadPoolExecutor and its associated Thread will stay alive forever although there is an obvious attempt at shutting down the thread in such case (ThreadPoolExecutor's finalizer)

      While ThreadPoolExecutor.finalize() calls the shutdown() method which should tear down the waiting threads, this never happens, as the threads keep reference to the TPE instance on the stack ("this"). This causes a leak.

      While we have found this problem through a bug on our side (which we already fixed), I still believe this is actual bug and the scenario with creating executors and forgetting about them should be supported.

            martin Martin Buchholz
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: