RFR for JDK-8025198 Intermittent test failure: java/util/concurrent/ThreadPoolExecutor/ThrowingTasks.java

Tristan Yan tristan.yan at oracle.com
Fri Nov 1 14:17:15 UTC 2013


/Hi Everyone

/

/I am working on bug https://bugs.openjdk.java.net/browse/JDK-8025198. 
Root cause for this bug is //there is a race condition on below code. 
//there is a very small chance that when 11th thread finishes 
allStarted.countDown() and before check the count, 10th thread does 
countDown, then 2nd to 11th threads go into wait allStarted and last 
thread can't get the execution because the BlockingQueue is full. /

/            allStarted.countDown(); //
//            if (allStarted.getCount() < getCorePoolSize()) //
/

/I am going to fixed above code as below//
//            lock.lock();//
//            boolean lessThanCorePoolSize = false;//
//            try{//
//                allStarted.countDown();//
//                lessThanCorePoolSize = allStarted.getCount() < 
getCorePoolSize();//
//            } finally {//
//                lock.unlock();//
//            }//
//            if (lessThanCorePoolSize) //
///

//

/Please let me know if you have any comments or suggestions.//
//
//Tristan//
/



More information about the core-libs-dev mailing list