Unexpected exit with no stack trace or other information
--------------------------------------------------------
Key: JBRULES-1060
URL:
http://jira.jboss.com/jira/browse/JBRULES-1060
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.0.GA
Environment: Windows XP sp2, 1GB RAM, Sun Java JDK 1.5.0_11, Eclipse 3.3 Build
id: I20070621-1340, JBOSS Rules feature/plugin 4.0.0
Reporter: christopher barham
Assigned To: Mark Proctor
When inserting a number of facts, (seems to be somewhere around 450 facts in this test
example here), the rules system exits unexpectedly with no stack trace or other
information. I pared down my code to a simple example that demonstrates this below. I
can get it to run normally if I insert 450 facts, however 475 or above exhibits this
unexpected system exit. I am running this from Eclipse.
Garbage.java (fact bean):
package com.sample;
public class Garbage {
private char id;
private int someNumber;
public Garbage(char garbageId, int someNumber) {
setSomeNumber(someNumber);
setId(garbageId);
}
public char getId() {
return id;
}
public int getSomeNumber() {
return someNumber;
}
public void setId(char id) {
this.id = id;
}
public void setSomeNumber(int someNumber) {
this.someNumber = someNumber;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("a Garbage { ");
sb.append("someNumber= ");
sb.append(getSomeNumber());
sb.append(", id= ");
sb.append(getId());
sb.append(" }");
return sb.toString();
}
}
StrangeExit.Java (Rule Engine startup and fact insertion):
package com.sample;
import java.io.InputStreamReader;
import java.io.Reader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.drools.event.DebugWorkingMemoryEventListener;
import org.drools.rule.Package;
public class StrangeExit {
public static final void main(String[] args) {
try {
long startTime = System.currentTimeMillis();
System.out.println("Starting problem at " + new java.util.Date());
RuleBase ruleBase = readRule();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
workingMemory.addEventListener(new DebugWorkingMemoryEventListener());
assertAllFacts(workingMemory);
workingMemory.fireAllRules();
long stopTime = System.currentTimeMillis();
long runTime = stopTime - startTime;
System.out.println("Run time (milliseconds): " + runTime);
System.out.println("Finished problem at " + new java.util.Date());
} catch (Throwable t) {
t.printStackTrace();
}
}
private static void assertAllFacts(WorkingMemory workingMemory) {
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= 475; j++) {
Garbage gar = new Garbage((char)(i + 64), j);
workingMemory.insert(gar);
}
}
}
private static RuleBase readRule() throws Exception {
Reader source = new
InputStreamReader(StrangeExit.class.getResourceAsStream("/strange.drl"));
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(source);
Package pkg = builder.getPackage();
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(pkg);
return ruleBase;
}
}
The Rule itself:
package com.sample
import com.sample.Garbage;
rule "Weird exit with no stack trace error"
when
$garA : Garbage( )
$garB : Garbage( id == 'B' , someNumber >= $garA.someNumber )
then
System.out.println("Something is up");
end
--
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