CDV ❯ LinkedBlockingQueue throws "java.lang.IllegalStateException: Queue full" when queue actually not full
-
Bug
-
Status: Closed
-
2 Major
-
Resolution: Fixed
-
DSO:L1
-
-
asi
-
Reporter: ssubbiah
-
January 23, 2007
-
0
-
Watchers: 0
-
July 27, 2012
-
January 30, 2007
Attachments
Description
I wrote some simple LinkedBlockingQueue test and it fails with the following exception when the Queue is actually not full.
Exception in thread “main” java.lang.IllegalStateException: Queue full at java.util.AbstractQueue.add(AbstractQueue.java:64) at com.tctest.concurrent.LinkedBlockingQueueTest.populateQueue(LinkedBlockingQueueTest.java:70) at com.tctest.concurrent.LinkedBlockingQueueTest.runTest(LinkedBlockingQueueTest.java:36) at com.tctest.concurrent.LinkedBlockingQueueTest.main(LinkedBlockingQueueTest.java:31)
The code is attached. One can run it using the accompanying script. Run as ./run.sh 2
It fails with the above exception once in a few runs. Note that the LinkedBlockingQueue was created with no bounds.
Exception in thread “main” java.lang.IllegalStateException: Queue full at java.util.AbstractQueue.add(AbstractQueue.java:64) at com.tctest.concurrent.LinkedBlockingQueueTest.populateQueue(LinkedBlockingQueueTest.java:70) at com.tctest.concurrent.LinkedBlockingQueueTest.runTest(LinkedBlockingQueueTest.java:36) at com.tctest.concurrent.LinkedBlockingQueueTest.main(LinkedBlockingQueueTest.java:31)
Fix the instrumentation. Add a LinkedBlockingQueuePerfTest.