soot-oss / soot

Soot - A Java optimization framework
GNU Lesser General Public License v2.1
2.87k stars 708 forks source link

Worker thread execution failed: Failed to apply jb to <com.google.firebase.snippets.FirebaseAuthSnippets: javax.ws.rs.core.Response clearSessionCookieAndRevoke(javax.ws.rs.core.Cookie)> #2024

Open buriedpot opened 11 months ago

buriedpot commented 11 months ago

Hi, when I use 4.2.1, this error never occurs or occurs few times.

Recently, I updated soot from 4.2.1 to 4.3.0, and then many programs throw Exceptions as below:


[ERROR] Worker thread execution failed: Failed to apply jb to 
java.lang.RuntimeException: Failed to apply jb to 
    at soot.asm.AsmMethodSource.getBody (AsmMethodSource.java:2282)
    at soot.SootMethod.retrieveActiveBody (SootMethod.java:446)
    at soot.PackManager.lambda$retrieveAllBodies$2 (PackManager.java:1252)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
Caused by: java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification (ArrayList.java:909)
    at java.util.ArrayList$Itr.next (ArrayList.java:859)
    at soot.FastHierarchy.getSignaturePolymorphicMethod (FastHierarchy.java:932)
    at soot.FastHierarchy.resolveMethod (FastHierarchy.java:833)
    at soot.FastHierarchy.resolveMethod (FastHierarchy.java:785)
    at soot.SootMethodRefImpl.tryResolve (SootMethodRefImpl.java:227)
    at soot.SootMethodRefImpl.tryResolve (SootMethodRefImpl.java:213)
    at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow (UnitThrowAnalysis.java:304)
    at soot.toolkits.exceptions.UnitThrowAnalysis$ValueSwitch.caseInstanceInvokeExpr (UnitThrowAnalysis.java:1181)
    at soot.toolkits.exceptions.UnitThrowAnalysis$ValueSwitch.caseVirtualInvokeExpr (UnitThrowAnalysis.java:1017)
    at soot.jimple.internal.AbstractVirtualInvokeExpr.apply (AbstractVirtualInvokeExpr.java:81)
    at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow (UnitThrowAnalysis.java:296)
    at soot.toolkits.exceptions.UnitThrowAnalysis$UnitSwitch.caseInvokeStmt (UnitThrowAnalysis.java:802)
    at soot.jimple.internal.JInvokeStmt.apply (JInvokeStmt.java:99)
    at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow (UnitThrowAnalysis.java:280)
    at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow (UnitThrowAnalysis.java:275)
    at soot.toolkits.graph.ExceptionalUnitGraph.buildExceptionDests (ExceptionalUnitGraph.java:277)
    at soot.toolkits.graph.ExceptionalUnitGraph.initialize (ExceptionalUnitGraph.java:220)
    at soot.toolkits.graph.ExceptionalUnitGraph. (ExceptionalUnitGraph.java:127)
    at soot.toolkits.graph.ExceptionalUnitGraphFactory.newExceptionalUnitGraph (ExceptionalUnitGraphFactory.java:55)
    at soot.toolkits.graph.ExceptionalUnitGraphFactory.createExceptionalUnitGraph (ExceptionalUnitGraphFactory.java:50)
    at soot.toolkits.scalar.LocalSplitter.internalTransform (LocalSplitter.java:109)
    at soot.BodyTransformer.transform (BodyTransformer.java:47)
    at soot.Transform.apply (Transform.java:126)
    at soot.JimpleBodyPack.applyPhaseOptions (JimpleBodyPack.java:65)
    at soot.JimpleBodyPack.internalApply (JimpleBodyPack.java:112)
    at soot.Pack.apply (Pack.java:126)
    at soot.asm.AsmMethodSource.getBody (AsmMethodSource.java:2280)
    at soot.SootMethod.retrieveActiveBody (SootMethod.java:446)
    at soot.PackManager.lambda$retrieveAllBodies$2 (PackManager.java:1252)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
java.lang.RuntimeException: Failed to apply jb to 

Which configuration should I config for soot 4.3.0 to avoid this problem?

buriedpot commented 10 months ago

@timtadh @quentin @ihji @pcpratts

buriedpot commented 9 months ago

And I found that this error doesn't occur on windows but on ubuntu. The soot version is 4.3.0+.

buriedpot commented 9 months ago

According my own debugging, I found that the method SootClass.getMethodsByNameAndParamCount may introduce some bug. While it is calling getMethods(), other threads modify the methodList.