The effect of not using shadow facts
by Chris West
Hello,
With prior versions of JBoss Rules (3.0.5) I have been using JDK generated
dynamic proxies as facts, and they have been working fine. However, after
upgrading to JBoss Rules 4.0.0MR3, I cannot seem to get the dynamic proxies
to work as facts. It seems that even though a rule fires that changes a
field on the proxy, a second rule that should not be activated after the
update still fires.
According to the JDK javadoc documentation, dynamic proxies are created as
final. My assumption is that JBoss Rules is not creating Shadow facts for
these since they are final. After reading the JIRA at
http://jira.jboss.com/jira/browse/JBRULES-960, I now am questioning what the
effect of not using shadow facts is on the engine. The relevant part of
that is:
"The problem is that SpringAOP is generating a proxy whose methods equals()
and hashCode() are "final". As drools must either override these methods in
the shadow proxy or not shadow the fact at all, I'm disabling shadow proxy
generation for this use case.
It is really important to note that if you are asserting SpringAOP proxies
as facts into the working memory, you will not be able to change any field
value whose field is constrained in rules or you may incur in a memory leak
and non-deterministic behavior by the rules engine. Unfortunately there is
nothing we can do about, since when SpringAOP makes the methods equals and
hashcode final, we can't override them anymore and as so, we can't shadow
them."
[ Show » <http://jira.jboss.com/jira/browse/JBRULES-960> ]
Edson Tirelli<http://jira.jboss.com/jira/secure/ViewProfile.jspa?name=tirelli>
[02/Jul/07 03:29 PM] The problem is that SpringAOP is generating a proxy
whose methods equals() and hashCode() are "final". As drools must either
override these methods in the shadow proxy or not shadow the fact at all,
I'm disabling shadow proxy generation for this use case. It is really
important to note that if you are asserting SpringAOP proxies as facts into
the working memory, you will not be able to change any field value whose
field is constrained in rules or you may incur in a memory leak and
non-deterministic behavior by the rules engine. Unfortunately there is
nothing we can do about, since when SpringAOP makes the methods equals and
hashcode final, we can't override them anymore and as so, we can't shadow
them.
Although I'm not using SpringAOP, I believe my facts are not being
shadowed.
Is it true that not using shadow facts may lead to non-deterministic
behavior? Prior to shadow facts, the engine seemed to handle it. Any
chance of reverting back to the old style of truth maintenance in the case
of not using shadow facts.
I apologize if I'm not on the right track here. My only test case for my
problem is the entire application right now, so I cannot offer it for
discussion. Any advice would be greatly appreciated.
Thanks,
-Chris West
18 years, 5 months
Modify Object and Fact Handles
by dpark
I'm in the process of upgrading from 2.1 to 3.0 and I've noticed the
signature for knowledgeHelper.modifyObject( Object object ) has changed to
include a FactHandle for it.
Architecturally, does this imply that a list of all fact handles for all
asserted objects has to be maintained in order for modifications to occur?
Or would the following call be the way out?
knowledgeHelper.modifyObject( knowledgeHelper.getWorkingMemory()
.getFactHandle( someObject ), someObject );
(curiously, the above could gives me NPE's on the factHandle for
someObject).
DP
--
View this message in context: http://www.nabble.com/Modify-Object-and-Fact-Handles-tf4132409.html#a1175...
Sent from the drools - user mailing list archive at Nabble.com.
18 years, 5 months
Decision Table - Object equality example
by dpark
I'm in the process of upgrading our decision table rules from 2.1 to 3.0.
However I've run into a bit of a snag that I hope someone can help me with.
We have a generalized consolidation rule that:
* takes 2 parameters of the same Object Type
* makes sure that they don't point to the same reference
* makes sure a field is the same
* and finally retracts one of the objects from working memory (and updates
some statistics on the survivor object)
It just seems a little fuzzy to me how I would write that in a DRL and a
Decision Table.
(I'm finding the decision table documentation and supplied example a little
on the light side)
Any sympathetic helpers out there?
Much appreciated,
Dave Park
--
View this message in context: http://www.nabble.com/Decision-Table---Object-equality-example-tf4130937....
Sent from the drools - user mailing list archive at Nabble.com.
18 years, 5 months
Decision Table does not support Agenda Groups
by Arjun Dhar
Hi,
I reported this earlier also, I cant understand why do we not provide AGENDA-
Group support for Decision tables, while we do provide Activation?
See DefaultRuleSheetListener.
I need to do two things:
1. Support sequencing of rule groups
2. allow two modes: a. Execute all rules, b. Break on first rule
1 --> Solution: Agenda groups :o( <-- NOT SUPPORTED in decision table
2 --> Solution: Activation Group: :o)
.. is there any reason for not supporting Agenda Groups in D.Tables ????
regards,
Arjun
18 years, 5 months
BRMS Server - memory Issue while execution - Critical
by Arjun Dhar
Hi,
I've been building a BRMS server over the Drools 4MR2 API.
The Server has a Boot process to allow to make it become a Rule server(s).
reads and XML configuration in which a user can specify the location of the
DRL, XLS, CVS, etc. During the Boot proocess it verifies thew authenticity of
each resource it loads. To sommarize:
<Session 1 type="Stateless">
<Rule Source 1>
<Rule Source 2>
..
<Adapter ExternalService class="..."/>
<Session>
<Session 2 type="Stateful">
<Rule Source 1>
<Rule Source 2>
..
<Session>
..well its more, but I guess this paints the picture.
It creates a Pool of Sessions. Now I know creating a Session is inexpensive,
but the process of creating them and authentication of resources etc. (Required
for prodcution quality system)
Once the server is up, requests are serviced. the request knows which session
it wants and facts are asserted per request. The request can be Synchronous or
Async and single or batch.
For testing I'm using: (JMeter test Case)
Session mode: STATELESS
Synchronous
Mode: Batch of 5 facts (composing of other objects (about 5) which are asserted
into the Session as well) at at a time
Loop: 10,000 <-- Does not matter how fast or slow I trow this at the engine
After the request is processed and results logged; Result and what rules led to
that result. I even nullify the top level Business obejcts. (a desperate
attempt to free memory)
After about 10,000 loops the System goes out of memory.
Sorry to bore you so far, but it was important you have the right context :o)
QUESTION:: Is the session maintaining references to those objects ever after
executing them? Why are the objects not being released?
Specially I'd imagine for a STATELESS session (which is what I've set as
default).
Using JMeter this system crashes every time under load, even with a single
Thread. Clearly objects are not being released.
The error I get may help you: (Along with out of memory). This exception only
comes under Load conditions.
Admin:ERROR: [com.myserver.brms.demos.certify.web.servlet.CertifyWebRequests]
[service] :org.drools.spi.ConsequenceException: java.lang.NullPointerException
at org.drools.common.DefaultAgenda.fireActivation
(DefaultAgenda.java:501)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:461)
at org.drools.common.AbstractWorkingMemory.fireAllRules
(AbstractWorkingMemory.java:373)
at org.drools.reteoo.ReteooStatelessSession.execute
(ReteooStatelessSession.java:72)
at com.myserver.brms.sessions.RulesEngineSessionJBossRules4.execute
(RulesEngineSessionJBossRules4.java:113)
at
com.myserver.brms.services.execute.recore.batch.ExecuteSessionBatch.executeBatch
(ExecuteSessionBatch.java:160)
Please help me! This is the only downtime issue I face and unfortunatley its
the most critical point of failure.
All thats left is to build an RMI service with a console dameon shell to give
it the final touches. Once this is done i'd like to share the deisng with you
guys if you like it.
18 years, 5 months
The method modify(MyBusinessObject) is undefined for the type Rule_xxx
by Arjun Dhar
Hi,
I took the latest Snapshots from the trunk, to check if the memory leak
problem was fixed, but in compiling the rules i got:
The method modify(MyBusinessObject) is undefined for the type Rule_xxx
Have you removed "modify()"? so By default modify will be invoked without
having to explicitly call it?
Thanks,
Arjun
18 years, 5 months