Closed traiansf closed 7 years ago
Per @yilongli observation: This is a duplicate of https://runtimeverification.com/support/predict/issues/264
Taking @yilongli 's suggestion, I disabled some instrumentation on the classes which were causing errors like the above:
diff --git a/rv-predict-source/src/main/java/com/runtimeverification/rvpredict/instrument/transformer/MethodTransformer.java b/rv-predict-source/src/main/java/com/runtimeverification/rvpredict/instrument/transformer/MethodTransformer.java
index cd4b53a..19bef8b 100644
--- a/rv-predict-source/src/main/java/com/runtimeverification/rvpredict/instrument/transformer/MethodTransformer.java
+++ b/rv-predict-source/src/main/java/com/runtimeverification/rvpredict/instrument/transformer/MethodTransformer.java
@@ -281,7 +281,7 @@ public class MethodTransformer extends MethodVisitor implements Opcodes {
}
}
} else {
- if (owner.startsWith("[") || isSelfCtorCall || !strategy.logCallStackEvent()) {
+ if (owner.startsWith("[") || isSelfCtorCall || !strategy.logCallStackEvent() || owner.contains("RandomDecisionForestBuilder") || owner.contains("OldTreeBuilder")) {
mv.visitMethodInsn(opcode, owner, name, desc, itf);
return;
}
And rv-predict
managed to predict some races:
Data race on field quickml.supervised.tree.branchingConditions.StandardBranchingConditions.minSplitFraction: {{{
Concurrent read in thread T17 (locks held: {Monitor@36b12d79, Monitor@3d34d211})
----> at quickml.supervised.tree.branchingConditions.StandardBranchingConditions.copy(StandardBranchingConditions.java:114)
- locked Monitor@3d34d211 at quickml.supervised.tree.branchingConditions.StandardBranchingConditions.copy(StandardBranchingConditions.java:n/a)
at quickml.supervised.tree.branchFinders.branchFinderBuilders.BranchFinderBuilder.copy(BranchFinderBuilder.java:71)
at quickml.supervised.tree.decisionTree.treeBuildContexts.DTreeContextBuilder.copyBranchFinderBuilders(DTreeContextBuilder.java:82)
at quickml.supervised.tree.decisionTree.treeBuildContexts.DTreeContextBuilder.deepCopyConfig(DTreeContextBuilder.java:196)
at quickml.supervised.tree.decisionTree.treeBuildContexts.DTreeContextBuilder.copy(DTreeContextBuilder.java:72)
- locked Monitor@36b12d79 at quickml.supervised.tree.decisionTree.treeBuildContexts.DTreeContextBuilder.copy(DTreeContextBuilder.java:n/a)
at quickml.supervised.tree.TreeBuilderHelper.<init>(TreeBuilderHelper.java:27)
at quickml.supervised.tree.decisionTree.DecisionTreeBuilder.buildPredictiveModel(DecisionTreeBuilder.java:52)
at quickml.supervised.ensembles.randomForest.randomDecisionForest.RandomDecisionForestBuilder.buildModel(RandomDecisionForestBuilder.java:92)
T17 is created by T1
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1028)
Concurrent write in thread T19 (locks held: {})
----> at quickml.supervised.tree.branchingConditions.StandardBranchingConditions.update(StandardBranchingConditions.java:107)
at quickml.supervised.tree.treeBuildContexts.TreeContextBuilder.updateEachConfigElement(TreeContextBuilder.java:78)
at quickml.supervised.tree.treeBuildContexts.TreeContextBuilder.initializeConfig(TreeContextBuilder.java:96)
at quickml.supervised.tree.decisionTree.DecisionTreeBuilder.buildPredictiveModel(DecisionTreeBuilder.java:51)
at quickml.supervised.ensembles.randomForest.randomDecisionForest.RandomDecisionForestBuilder.buildModel(RandomDecisionForestBuilder.java:92)
T19 is created by T1
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1028)
}}}
Same for field quickml.supervised.tree.branchingConditions.StandardBranchingConditions.minScore
Same for field quickml.supervised.tree.branchingConditions.StandardBranchingConditions.minSplitFraction
Same for field quickml.supervised.tree.branchingConditions.StandardBranchingConditions.minLeafInstances
Same for field quickml.supervised.tree.branchingConditions.StandardBranchingConditions.maxDepth
Data race on field quickml.supervised.tree.branchingConditions.StandardBranchingConditions.minScore: {{{
Concurrent write in thread T17 (locks held: {})
----> at quickml.supervised.tree.branchingConditions.StandardBranchingConditions.update(StandardBranchingConditions.java:103)
at quickml.supervised.tree.treeBuildContexts.TreeContextBuilder.updateEachConfigElement(TreeContextBuilder.java:78)
at quickml.supervised.tree.treeBuildContexts.TreeContextBuilder.initializeConfig(TreeContextBuilder.java:96)
at quickml.supervised.tree.decisionTree.DecisionTreeBuilder.buildPredictiveModel(DecisionTreeBuilder.java:51)
at quickml.supervised.ensembles.randomForest.randomDecisionForest.RandomDecisionForestBuilder.buildModel(RandomDecisionForestBuilder.java:92)
T17 is created by T1
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1028)
Concurrent write in thread T19 (locks held: {})
----> at quickml.supervised.tree.branchingConditions.StandardBranchingConditions.update(StandardBranchingConditions.java:103)
at quickml.supervised.tree.treeBuildContexts.TreeContextBuilder.updateEachConfigElement(TreeContextBuilder.java:78)
at quickml.supervised.tree.treeBuildContexts.TreeContextBuilder.initializeConfig(TreeContextBuilder.java:96)
at quickml.supervised.tree.decisionTree.DecisionTreeBuilder.buildPredictiveModel(DecisionTreeBuilder.java:51)
at quickml.supervised.ensembles.randomForest.randomDecisionForest.RandomDecisionForestBuilder.buildModel(RandomDecisionForestBuilder.java:92)
T19 is created by T1
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:1028)
}}}
Same for field quickml.supervised.tree.branchingConditions.StandardBranchingConditions.minLeafInstances
Same for field quickml.supervised.tree.branchingConditions.StandardBranchingConditions.maxDepth
This seems to indicate that the StandardBranchingConditions fields could be updated simultaneously by two threads. The question is whether two threads would attempt to put different information
W.r.t. the error: @yilongli recalled he has previously encountered it, and it might be an ASM / JDK bug: http://forge.ow2.org/tracker/?group_id=23&atid=100023&func=detail&aid=317583
Related to this particular example, this is one of the ways the test can fail:
java.lang.AssertionError: attribute: ecp. branch.getProbabilityOfTrueChild(): 0.9
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at quickml.supervised.tree.decisionTree.DecisionOldOldTreeBuilderTest$Conditions.satisfiesBranchConditions(DecisionOldOldTreeBuilderTest.java:159)
at quickml.supervised.tree.decisionTree.DecisionOldOldTreeBuilderTest$Conditions.satisfiesConditions(DecisionOldOldTreeBuilderTest.java:152)
at quickml.supervised.tree.decisionTree.DecisionOldOldTreeBuilderTest.recurseTree(DecisionOldOldTreeBuilderTest.java:127)
at quickml.supervised.tree.decisionTree.DecisionOldOldTreeBuilderTest.recurseTree(DecisionOldOldTreeBuilderTest.java:130)
at quickml.supervised.tree.decisionTree.DecisionOldOldTreeBuilderTest.recurseTree(DecisionOldOldTreeBuilderTest.java:130)
at quickml.supervised.tree.decisionTree.DecisionOldOldTreeBuilderTest.recurseTree(DecisionOldOldTreeBuilderTest.java:129)
at quickml.supervised.tree.decisionTree.DecisionOldOldTreeBuilderTest.mockTreeTest(DecisionOldOldTreeBuilderTest.java:91)
which I guess it could fail due to the above mentioned races.
@grosu FYI @yilongli I think you're still the most knowledgable w.r.t. that part of the code. Could you please take a look at it? I'm wondering whether there could be two agents modifying the code concurrently (one being ours, the other being
TestNG
)I was trying to use rv-predict to address Darko's
quickml
question, when I got what it seems like an instrumentation error:Reproduction steps:
Followed by modifying pom.xml according to this diff:
Followed by
Resulted in a run exhibiting errors like the one at the top.