[JBoss JIRA] Created: (JBRULES-614) logically asserted facts do not get retracted properly
by Philipp Rechberger (JIRA)
logically asserted facts do not get retracted properly
------------------------------------------------------
Key: JBRULES-614
URL: http://jira.jboss.com/jira/browse/JBRULES-614
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 3.0.5
Reporter: Philipp Rechberger
Assigned To: Mark Proctor
1) Setup the following rules:
rule "#1: value out of range (verification)"
when
val : Value( value > 100 )
then
System.out.println("found invalid value: " + val.getValue());
assertLogical(new Message("value out of range"));
end
rule "#2: value out of range (print out)"
when
Message( message == "value out of range" )
then
System.out.println("value out of range");
end
2) Assert a Value fact that triggers rule #1 (note that the Value Bean provides Property Change Support for its "value" attribute):
// assert fact - invalid value
Value value = new Value(101);
FactHandle handle = workingMemory.assertObject(value);
workingMemory.fireAllRules();
=> Output looks like this:
found invalid value: 101
value out of range
--- working memory dump ---
class com.sample.Value: value = 101
class com.sample.Message: value out of range
3) Now modify the Value fact:
// modify fact - invalid value
value.setValue(102);
workingMemory.modifyObject(handle, value);
workingMemory.fireAllRules();
=> Output looks like this:
found invalid value: 102
value out of range
--- working memory dump ---
class com.sample.Value: value = 102
class com.sample.Message: value out of range
class com.sample.Message: value out of range
=> A bit strange here: we have two Message objects - but this could be ok if both objects get retracted after modifying Value fact's value, so that it does not support the truth for rule #1... let's test
4) Modify the value fact again:
// modify fact - valid value
value.setValue(100);
workingMemory.modifyObject(handle, value);
workingMemory.fireAllRules();
=> Output looks like this:
<none>
--- working memory dump ---
class com.sample.Value: value = 100
class com.sample.Message: value out of range
Conclusion: There is still a Message fact in the working memory that was asserted logically (by rule) due to the fact Value ( value > 100 ), which does not exist any more! The (second) Message fact must be retracted too OR logically asserted facts must be asserted only once (even if the according rule is triggered multiple times). Otherwise the statement in the documentation is incorrect (chapter 3.5.2): "assertLogical(new Something());" is similar to assert, but the object will be automatically retracted when there are no more facts to support the truth of the currently firing rule".
--
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
19 years, 2 months
[JBoss JIRA] Created: (JBRULES-607) Working memory is not disposed when releasing the RuleSession
by Einat Idan (JIRA)
Working memory is not disposed when releasing the RuleSession
-------------------------------------------------------------
Key: JBRULES-607
URL: http://jira.jboss.com/jira/browse/JBRULES-607
Project: JBoss Rules
Issue Type: Patch
Security Level: Public (Everyone can see)
Components: JSR94
Affects Versions: 3.0.1
Reporter: Einat Idan
Assigned To: Mark Proctor
Under heavy load conditions I encountered high cpu and hangs of the system. A thread dump shows all threads being stuck in
java.util.WeakHashMap, which is called from AbstractRuleBase.addWorkingMemory (please refer to linked thread).
After digging into the code it turned out that the client session object (AbstractRuleSessionImpl) has a release method. This method is supposed to releases all resources used by this rule session. And so it sets the properties, the working memory and the RuleExecutionSet to null:
public void release() {
this.setProperties( null );
this.setWorkingMemory( null );
this.setRuleExecutionSet( null );
}
However, it does NOT dispose the working memory as expected.
I added the following line to method:
getWorkingMemory().dispose();
Afterwards things improved significantly.
--
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
19 years, 2 months
[JBoss JIRA] Created: (JBRULES-667) Combination of Or condition and simple fact fails to evaluate
by Frederic Burlet (JIRA)
Combination of Or condition and simple fact fails to evaluate
-------------------------------------------------------------
Key: JBRULES-667
URL: http://jira.jboss.com/jira/browse/JBRULES-667
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 3.1-m1
Environment: Debian Linux Unstable
Java 1.4
Reporter: Frederic Burlet
Assigned To: Mark Proctor
Attachments: conditions-test.tar.gz
When we have a lhs containing a combination of or condition and simple fact like:
.... when
MyBean(property == value_1) or MyBean(property == value_2)
OtherBean( )
then....
The engine throwing a NPE when adding rules.
It also fails with the same error when conditions are written in a different order.
See attached test case in order to reproduce. This has been tested against the trunk revision #9453.
--
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
19 years, 2 months