-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
5.0
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP Pro sp2
EXTRA RELEVANT SYSTEM CONFIGURATION :
multiple threads
A DESCRIPTION OF THE PROBLEM :
Caused by: java.lang.NullPointerException
at java.util.concurrent.LinkedBlockingQueue.peek(LinkedBlockingQueue.java:440)
this function is
public E peek() {
if (count.get() == 0)
return null;
final ReentrantLock takeLock = this.takeLock;
takeLock.lock();
try {
Node<E> first = head.next;
if (first == null)
return null;
else
return first.item;
} finally {
takeLock.unlock();
}
}
line 440 is Node<E> first = head.next;
i think that you need to add in line 440
if (count.get() == 0)
return null;
a second time. the difference this time is that you are in a protected section enforced by takeLock.lock();
thanks.
REPRODUCIBILITY :
This bug can be reproduced occasionally.
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP Pro sp2
EXTRA RELEVANT SYSTEM CONFIGURATION :
multiple threads
A DESCRIPTION OF THE PROBLEM :
Caused by: java.lang.NullPointerException
at java.util.concurrent.LinkedBlockingQueue.peek(LinkedBlockingQueue.java:440)
this function is
public E peek() {
if (count.get() == 0)
return null;
final ReentrantLock takeLock = this.takeLock;
takeLock.lock();
try {
Node<E> first = head.next;
if (first == null)
return null;
else
return first.item;
} finally {
takeLock.unlock();
}
}
line 440 is Node<E> first = head.next;
i think that you need to add in line 440
if (count.get() == 0)
return null;
a second time. the difference this time is that you are in a protected section enforced by takeLock.lock();
thanks.
REPRODUCIBILITY :
This bug can be reproduced occasionally.
- relates to
-
JDK-6454444 SEGV on solaris-i586 -server running ConcurrentQueueLoops
- Resolved
-
JDK-6454475 NPE on solaris-i586 -server running ConcurrentQueueLoops
- Closed