[jboss-dev] Strange java.util.LinkedList.contains() NPE

Dimitris Andreadis dandread at redhat.com
Thu Jan 24 13:31:48 EST 2008


Andrew Dinn wrote:
> Andrew Dinn wrote:
>> Andrew Dinn wrote:
>>> It could be a concurrency bug. The relevant code is
>>>
>>> . . .
>>> 105            for (Entry e = header.next; e != header; e = e.next) {
>>> 106                if (o.equals(e.element))
>>> 107                    return index;
>>> 108                index++;
>>> 109            }
>>> . . .
>>
>> Oops, first off, apologies for posting an analysis which was obviously 
>> wrong.
> 
> Ok, I know I'm replying to my own reply to my reply but I'll just note 
> that my initial analysis was not 'obviously' wrong. It's actually more 
> subtle than that as it might just be right depending upon whether the 
> value of field header is refetched if a yield occurs between execution 
> of 'e = header.next' and 'e != header'. This may or may not happen at a 
> compiler's whim since the code does not employ any synchronization.
> 
> Anyway, a concurrent remove is a much more likely culprit.

Yes, seems like a concurrent access issue. On the other hand, concurrent access to the 
MainDeployer is not really common in the testsuite. There is just the scanner thread and the 
testsuite that may perform deployments/undeployments.



More information about the jboss-development mailing list