JDK-6316155 : LinkedBlockingQueue: q.offer(xyz) returns false positives and/or q.remove(xyz) gives up too easily
Type:Bug
Component:core-libs
Sub-Component:java.util.concurrent
Affected Version:3.06
Priority:P4
Status:Closed
Resolution:Fixed
OS:solaris_10
CPU:generic
Submitted:2005-08-25
Updated:2010-04-03
Resolved:2007-11-28
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
EVALUATION
I will be adding a test case, thus turning this into a "missing test" bug,
and so not closing this as a dup of 6215625.
02-09-2005
EVALUATION
This does appear to be a simular test case. I would only suggest you add the simplified test case to the Java regression test suite before closing as a duplicate. Cheers.
02-09-2005
EVALUATION
Here is a simpler test case:
--------------------------------
import java.util.concurrent.*;
public class Bug2 {
public static void main(String[] args) throws Throwable {
final BlockingQueue<String> q = new LinkedBlockingQueue<String>(10);
final int count = 1000;
new Thread() {
public void run() {
for (int i = 0, j = 0; i < count; i++) {
for (;;) {
if (q.remove(String.valueOf(i)))
break;
if (++j % 1000000 == 0) {
System.out.println("q.remove(\"" + i +
"\") failed " + j +
" times, q.size() = " + q.size());
}
}
}
}}.start();
new Thread() {
public void run() {
for (int i = 0, j = 0; i < count; i++) {
for (;;) {
if (q.offer(String.valueOf(i)))
break;
if (++j % 1000000 == 0) {
System.out.println("q.offer(\"" + i +
"\") failed " + j +
" times, q.size() = " + q.size());
}
}
}
}}.start();
}
}
--------------------------------
This bug is not reproducible in the not-yet-released internal build of b51, whereas it
is reproducible in the about to be released build 50, which probably means that this is
a duplicate of
6215625: LinkedBlockingQueue.extract throws NPE
This bug fix will make it into mustang b51 and tiger update 7.
I will close this soon as a dup unless someone yells.