[Soot-list] Soot-2.4.0 bug? SynchObliviousMhpAnalysis.java:288 throws java.util.ConcurrentModificationException

Jeff jeffwalt630 at gmail.com
Thu Jun 24 12:32:35 EDT 2010


Thanks Paris. I understand the problem. So this is a bug in Soot.
Anyone going to fix it?

Jeff

On Thu, Jun 24, 2010 at 11:42 PM, Paris Yiapanis <yiapanip at cs.man.ac.uk>wrote:

>
>
> Hi Jeff,
>>
>> The problem is that you are modifying the collection while you are
>> iterating through. This is not allowed with fail-fast iterators. It throws
>> an exceptions as this can cause unpredictable results.
>>
>> You could try maybe using some collection that supports concurrent
>> modification.
>>
>> Or maybe you find a way around this.
>>
>> For example (if I remember well), using a HashMap you could have the same
>> problems. However, if you get the keySet of the map, you could go through
>> the collection without using the iterator and inspect the items with
>> .get(..) and subsequently remove the ones you want.
>>
>> I hope that helps.
>>
>> - Paris
>>
>>
>> On Thu, Jun 24, 2010 at 12:32 PM, Jeff <jeffwalt630 at gmail.com> wrote:
>>
>>>
>>> Dear Eric and all,
>>>
>>> I am using Soot-2.4.0 to analyze a multi-threaded application and the
>>> following exception crashes the program:
>>>
>>> Caused by: java.util.ConcurrentModificationException
>>>     at
>>> java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
>>>     at java.util.AbstractList$Itr.next(AbstractList.java:343)
>>>     at
>>> soot.jimple.toolkits.thread.mhp.SynchObliviousMhpAnalysis.run(SynchObliviousMhpAnalysis.java:288)
>>>     at
>>> soot.jimple.toolkits.thread.mhp.SynchObliviousMhpAnalysis.buildMHPLists(SynchObliviousMhpAnalysis.java:61)
>>>     at
>>> soot.jimple.toolkits.thread.mhp.SynchObliviousMhpAnalysis.<init>(SynchObliviousMhpAnalysis.java:47)
>>>     at
>>> soot.jimple.toolkits.thread.mhp.UnsynchronizedMhpAnalysis.<init>(UnsynchronizedMhpAnalysis.java:7)
>>>     at
>>> edu.hkust.clap.transformer.phase1.WholeProgramTransformer.internalTransform(WholeProgramTransformer.java:47)
>>> .....
>>>
>>>
>>> The corresponding source code @ SynchObliviousMhpAnalysis.run:
>>>
>>>         boolean addedNew = true;
>>>         while(addedNew)
>>>         {
>>>             addedNew = false;
>>>             Iterator<AbstractRuntimeThread> it =
>>> runAtOnceCandidates.iterator();
>>>             while(it.hasNext())
>>>             {
>>> 288:          AbstractRuntimeThread someThread = it.next();
>>>                 SootMethod someStartMethod =
>>> someThread.getStartStmtMethod();
>>>                 if(mayHappenInParallelInternal(someStartMethod,
>>> someStartMethod))
>>>                 {
>>>                     MHPLists.add(someThread); // add a second copy of it
>>>                     someThread.setStartMethodMayHappenInParallel();
>>>                     someThread.setRunsMany();
>>>  295:             runAtOnceCandidates.remove(someThread);
>>>                     if(optionPrintDebug)
>>>                         G.v().out.println(someThread.toString());
>>>                     addedNew = true;
>>>                 }
>>>             }
>>>         }
>>>
>>>
>>> Clearly the problem is caused by invoking "next()" on the List
>>> "runAtOnceCandidates" at line 288 after calling "remove()" at line 295 on
>>> it.
>>>
>>>
>>> -Jeff
>>>
>>>
>>> _______________________________________________
>>> Soot-list mailing list
>>> Soot-list at sable.mcgill.ca
>>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100625/4df6760d/attachment.html 


More information about the Soot-list mailing list