[
http://jira.jboss.com/jira/browse/JBRULES-1392?page=comments#action_12399045 ]
Navaljit Bhasin commented on JBRULES-1392:
------------------------------------------
I tried compiling from the link
http://anonsvn.labs.jboss.com/labs/jbossrules/branches/4.0.x/
Never used maven before:
Here's what I used
mvn clean install
However the build is failing with following error.
Results :
Failed tests:
testDirectory(org.drools.agent.RuleAgentTest)
testNotRemoveIdentities(org.drools.reteoo.CrossProductTest)
Tests run: 460, Failures: 2, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: There are test failures.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:560)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:480)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecy
cle(DefaultLifecycleExecutor.java:896)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(Def
aultLifecycleExecutor.java:734)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:510)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
Goal(DefaultLifecycleExecutor.java:493)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:463)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:224)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
at jrockit.reflect.InitialMethodInvoker.invoke(Ljava.lang.Object;[Ljava.
lang.Object;)Ljava.lang.Object;(Unknown Source)
at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;
I)Ljava.lang.Object;(Unknown Source)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures
.
at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugi
n.java:425)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:447)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:539)
... 18 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24 seconds
[INFO] Finished at: Sun Feb 10 17:05:57 EST 2008
[INFO] Final Memory: 23M/64M
[INFO] ------------------------------------------------------------------------
Rules behave incorrectly (randomly) in multi-threaded environment
-----------------------------------------------------------------
Key: JBRULES-1392
URL:
http://jira.jboss.com/jira/browse/JBRULES-1392
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Reteoo
Affects Versions: 4.0.3
Reporter: Brian Stiles
Assigned To: Edson Tirelli
Priority: Blocker
Fix For: 5.0.0-M1, 4.0.5
Attachments: DroolsMVELFactoryProject.zip
Rules behave seemingly indeterminately when sessions are created from the same RuleBase
and executed in multiple threads. The problem is a bit difficult to reproduce. The
following code demonstrates the behavior in my environment (single processor PowerBook),
but not on every try. I've had up to 5 consecutive executions not exhibit the problem
before the failure was exhibited, so you may need to run the class a number of times to
see the problem. Also, I periodically get OutOfMemoryErrors when using the default heap
size (64m). I've had better success with -Xmx256m. That, by the way, is suspiciously
coincidental to the random nature of the incorrect rule firing problem.
I've experienced this behavior in my application, and it manifests by rules firing
from time to time that shouldn't have fired. I can't see a pattern to the rules
that fire inappropriately, and there absolutely were not facts asserted that would support
the firing of the rule.
Synchronizing the calls to insert, fireAllRules, and dispose on the session object seems
to get rid of the problem, giving further evidence to the guess that it's a
multithreading bug.
Please, please, please find a solution to this problem. This will be a serious
scalability problem for my application. I'm more than happy to help however I can.
I've stepped through Drools code before and found solutions, but I really don't
know where to go with this one.
Following is the code (self-contained class with main method) that I've used to
demonstrate the problem.
Thank you!
--
package sample;
import java.io.StringReader;
import java.util.ArrayList;
import org.drools.RuleBase;
import org.drools.RuleBaseConfiguration;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.compiler.PackageBuilder;
import org.drools.compiler.PackageBuilderConfiguration;
public class MultithreadedRuleBaseProblem {
public static void main(String[] args) throws Exception {
final PackageBuilderConfiguration packageBuilderConfiguration =
new PackageBuilderConfiguration();
final PackageBuilder packageBuilder = new
PackageBuilder(packageBuilderConfiguration);
packageBuilder.addPackageFromDrl(new StringReader("\n"
+ "package sample\n"
+ "\n"
+ "import java.lang.Integer;\n"
+ "global java.util.ArrayList shouldFireList;\n"
+ "global java.util.ArrayList shouldNotFireList;\n"
+ "\n"
+ "rule should_fire\n"
+ " when\n"
+ " $e : Integer(intValue == -1)\n"
+ " $f : Integer(intValue > $e)\n"
+ " then \n"
+ " shouldFireList.add($f);\n"
+ "end \n"
+ "\n"
+ "rule should_not_fire\n"
+ " when\n"
+ " $f : String()\n"
+ " then \n"
+ " shouldNotFireList.add($f);\n"
+ "end \n"));
final RuleBaseConfiguration ruleBaseConfiguration = new RuleBaseConfiguration();
final RuleBase ruleBase = RuleBaseFactory.newRuleBase(ruleBaseConfiguration);
ruleBase.addPackage(packageBuilder.getPackage());
final Exception[] exception = {
null
};
final Thread t[] = new Thread[50];
for (int i = 0; i < t.length; i++) {
final int count = i;
t[i] = new Thread(new Runnable() {
public void run() {
try {
System.out.println("Start " + count);
final int iterations = count * 15 + 3000;
final ArrayList shouldFireList = new ArrayList();
final ArrayList shouldNotFireList = new ArrayList();
final StatefulSession session2 = ruleBase.newStatefulSession();
session2.setGlobal("shouldFireList", shouldFireList);
session2.setGlobal("shouldNotFireList",
shouldNotFireList);
session2.insert(new Integer(- 1));
for (int k = 0; k < iterations; k++) {
session2.insert(new Integer(k));
}
session2.insert("foo");
System.out.println("Fire " + count);
session2.fireAllRules();
session2.dispose();
if (shouldFireList.size() != iterations) {
System.out.println("Thread "
+ count
+ " shouldFireList.size(): expected "
+ iterations
+ " was "
+ shouldFireList.size()
+ "\n!!!!! Thread "
+ count
+ " rule didn't fire as many times as it
should have!!!!!!!!!!!!!!!!!!");
}
} catch (Exception e) {
e.printStackTrace();
exception[0] = e;
}
System.out.println("Thread " + count + " done");
}
});
t[i].start();
}
for (int i = 0; i < t.length; i++) {
t[i].join();
}
System.out.println("done");
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira