[infinispan-dev] [jboss-dev] concurrency issue on ServiceLoader::iterator

Ales Justin ales.justin at gmail.com
Wed May 16 10:46:07 EDT 2012


I added a workaround for it -- preparing the immutable list in advance.
The patch is already merged, afaik.

But no idea why this is/was actually happening.

On May 16, 2012, at 4:16 PM, Manik Surtani wrote:

> Is this still an issue?
> 
> On 9 May 2012, at 16:55, Ales Justin wrote:
> 
>> Anyone ever seen this error?
>> 
>> Caused by: java.util.NoSuchElementException
>> 	at java.util.AbstractList$Itr.next(AbstractList.java:350) [classes.jar:1.6.0_31]
>> 	at java.util.Collections$1.nextElement(Collections.java:3389) [classes.jar:1.6.0_31]
>> 	at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:332) [classes.jar:1.6.0_31]
>> 	at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:415) [classes.jar:1.6.0_31]
>> 	at org.infinispan.distexec.spi.DistributedTaskLifecycleService.onPreExecute(DistributedTaskLifecycleService.java:50) [infinispan-core-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
>> 
>>  public <T> void onPreExecute(Callable<T> task) {
>>     try {
>>        Iterator<DistributedTaskLifecycle> i = loader.iterator();
>>        while (i.hasNext()) { // <------------------------------------------------- we CHECK before
>>           DistributedTaskLifecycle cl = i.next();
>>           cl.onPreExecute(task);
>> 
>> And I doubt I have multiple thread accessing it at the same time -- running this from serial testsuite.
>> 
>> I can reproduce this, atm, almost every time, where Vladimir (Blagojevic; Infinispan - author of DistributedTaskLifecycleService) cannot.
>> 
>> Any idea?
>> 
>> -Ales
>> 
>> 
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
> 
> --
> Manik Surtani
> manik at jboss.org
> twitter.com/maniksurtani
> 
> Lead, Infinispan
> http://www.infinispan.org
> 
> 
> 
> 
> _______________________________________________
> jboss-development mailing list
> jboss-development at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-development




More information about the infinispan-dev mailing list