Q: 8071326: ThreadPoolExecutor in endless thread creation loop if workQueue.take() throws RuntimeException

Lev Priima lev.priima at oracle.com
Tue Jan 27 15:43:18 UTC 2015

Using TPE w/ custom BlockingQueue and if RuntimeException happens in 
blocking BlockingQueue.take() method then this code

new ThreadPoolExecutor(1, 1, 0, TimeUnit.NANOSECONDS,
     new ArrayBlockingQueue<Runnable>(1) {
         public Runnable take() throws InterruptedException {
             throw new RuntimeException();

has an unbounded thread creation loop.

As a result there are many created unbounded threads in RUNNING state 
after printing stack trace to stderr by default 
UncaughtExceptionHandler. And these thread will be cleaned only when 
whole TPE finished.

Is this "Not an Issue"?


More information about the core-libs-dev mailing list