[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

possible bug: ConcurrentModificationException with spark and smalltest-program



On http://svn.sable.mcgill.ca/soot/soot/trunk -r1497, With the attached test-program: A.java.

When invoking "soot -w -p cg enabled -p wjtp enabled -app A -p cg verbose:on -p jb use-original-names:true -p cg.spark on", I get a "ConcurrentModificationException" for cIt.hasNext() in ContextInsensitiveBuilder.build() line 90:

for( Iterator cIt = Scene.v().getClasses().iterator(); cIt.hasNext(); ) {
final SootClass c = (SootClass) cIt.next();
handleClass( c );
}


While performing SparkTransformer.interalTransform. This is probably caused by the handleClass method in SparkTransformer adding new classes to the Scene.

I have rewritten ReachableMethods.addMethod:

    private void addMethod( MethodOrMethodContext m ) {
            if( set.add( m ) ) {
            	if ( false )
                	reachables.add( m );
            }
    }

In an attempt to make the analysis finish within reasonable time. I've waited more than 5 minutes without the ReachableMethods hack on my P4M-1700 Mhz.

Is this a bug? Or am I inducing this problem by reducing the call-graph in addMethod?

StackTrace:

java.util.ConcurrentModificationException
at soot.util.HashChain$LinkIterator.hasNext(HashChain.java:464)
at soot.jimple.spark.builder.ContextInsensitiveBuilder.build(ContextInsensitiveBuilder.java:90)
at soot.jimple.spark.SparkTransformer.internalTransform(SparkTransformer.java:53)
at soot.SceneTransformer.transform(SceneTransformer.java:39)
at soot.Transform.apply(Transform.java:83)
at soot.RadioScenePack.internalApply(RadioScenePack.java:60)
at soot.jimple.toolkits.callgraph.CallGraphPack.internalApply(CallGraphPack.java:36)
at soot.Pack.apply(Pack.java:110)
at soot.PackManager.runWholeProgramPacks(PackManager.java:319)
at soot.PackManager.runPacks(PackManager.java:288)
at soot.Main.run(Main.java:180)
at soot.Main.main(Main.java:154)


--
Helge
public class A extends Object {
	Object o;
	public static void main(String[] args) {
		Object o1 = new Object();
		Object o2 = new Object();
		A a1 = new A();
		a1.o = o1;
		A a2 = new A();
		a2.o = o2;
		Object o = a1.o;
		if ( args.length > 0 )
			a2.o = a1.o;
	}
}