[rules-users] Does anyone have a Fusion application running?

2011-12-15 Thread Robert Crawford
I'm asking because I'm continuously getting exceptions from mine. I get
exceptions from the engine when it's expiring events, I get exceptions while
inserting objects in my rules, I get them when I insert through a named
entry point, I get them for the sin of apparently just having a sliding time
window in my rules. They're all wrapped around NullPointerExceptions, and
while they don't shut the engine down, they ARE preventing the system from
working correctly.

None of this happens immediately. In the short-term everything appears to be
OK. It's after running for 6+ hours that I start to see this.

I'm running with 5.2.0-Final, which I know is not the latest release, but I
dropped back to it because, well, I was getting too many failures and
exceptions with 5.3.0.

I'm not inserting data from another thread. The rules engine is started with
fireUntilHalt, and when I have a data backlog to insert into it, I call halt
and the same thread that called fireUntilHalt loads the data, then calls
fireUntilHalt again.

I'm not using MultiThreadEvaluationOption -- which in my experience just
generates MORE exceptions than I'm getting now.

Nothing older than the event expiration age is being inserted.

Any advice? Any examples of a continuously-running Fusion application anyone
can share with me?

Thanks!


--
View this message in context: 
http://drools.46999.n3.nabble.com/Does-anyone-have-a-Fusion-application-running-tp3589002p3589002.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rules called with null references?

2011-11-22 Thread Robert Crawford
Another clue: these errors nearly disappear when I change garbage collection
settings. I hesitate to say they completely disappear, but in an hour of
running I've only seen one exception thrown from inside Drools code, as
opposed to many dozens before.

The difference is the presence of the options -XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode. If I run with those, I get activations with null
parameters. Without them, I don't.

I don't think Drools uses WeakReferences for anything, but I haven't been
through all the code. Could something like that be happening? Could the
objects be subjected to GC before the activation is created or fires?

Oh, I've also added an AgendaListenerEvent that examines the activations for
this condition and logs it happening.


--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-called-with-null-references-tp3477164p3528455.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rules called with null references?

2011-11-17 Thread Robert Crawford
I enhanced my ConsequenceExceptionHandler and have a little more detail on
this. I have this rule:

rule Duplicate Alerts
when
$firstAlert : TemperatureAlert( this.saved, this.valid )
$secondAlert : TemperatureAlert (this.location == $firstAlert.location,
this != $firstAlert, this.saved, this.valid )
then
LOG.info(Removing duplicate alert for  + $firstAlert.getLocation());
$secondAlert.setValid(false);
$secondAlert.setInvalidAt(new Date());
update($secondAlert);
end

The TemperatureAlert class is not defined as an event.

I'm getting this exception:

15:56:34,145 ERROR [STDERR] CONSEQUENCE EXCEPTION
15:56:34,145 ERROR [STDERR] Exception executing consequence for rule
Duplicate Alerts in xxx.xxx.rules: java.lang.NullPointerException
15:56:34,145 ERROR [STDERR] START FACT DUMP:
15:56:34,145 ERROR [STDERR]
$firstAlert:xxx.xxx.TemperatureAlert@1e3c1689
15:56:34,145 ERROR [STDERR] $secondAlert:null
15:56:34,145 ERROR [STDERR] END FACT DUMP
15:56:34,145 ERROR [STDERR] Exception executing consequence for rule
Duplicate Alerts in xxx.xxx.rules: java.lang.NullPointerException


I don't see how this activation could have ever happened. 

If there never was an object that qualified, the activation would never have
been scheduled.

If there was one, but it was updated so it no longer matched or was
retracted, then the activation would have been cancelled. 

Everything -- EVERYTHING -- for the session is done within a single thread:

   Runnable r = new Runnable() {
public void run() {
while (!shuttingDown) {
try {
session.fireUntilHalt();
while (!commandList.isEmpty()) {
commandList.take().execute();
}
} catch (Throwable t) {
t.printStackTrace();
}
}
}
};

The commandList is a BlockingQueue of objects that, when execute() is
called, variously insert, retract, or update objects. All the data feeding
into the session flows through that queue. The halt() method is called
either when the queue gets too long and periodically if it's not empty.

Any ideas?

--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-called-with-null-references-tp3477164p3517204.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Rules called with null references?

2011-11-03 Thread Robert Crawford
I have this rule:

rule Defrost: Turned On
when
$reading : SwitchReading( switchOn == true ) from entry-point
ReadingsStream
not SwitchReading (this.circuit == $reading.circuit, this after $reading
) from entry-point ReadingsStream
not DefrostSwitchOn(this.circuit == $reading.circuit)
then
LOG.info(Defrost switch turned on by reading ' + $reading + '.);
insert(new DefrostSwitchOn($reading));
end

SwitchReading is an event; DefrostSwitchOn is a POJO fact.

Multiple times I've gotten exceptions where this rule's RHS is called with a
null. The ConsequenceExceptionHandler is supposed to list the facts the RHS
was called with, but it's getting an empty list.

Now, I know my system as it currently stands can take a LONG time between
receiving an event and executing the consequence, primarily when it first
starts and is loading its previous known state. It's entirely believable to
me that the event will have expired before the rule's RHS is called. But
shouldn't the event still be referenced by the Activation?



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-called-with-null-references-tp3477164p3477164.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with troubleshooting rules/Drools

2011-11-01 Thread Robert Crawford
I've rolled back to 5.2.0 and it seems to be doing better. Almost an hour of
uptime.

I already have a custom consequence exception handler -- I think it's
cribbed from that link, even. But this exception doesn't appear to happen
during the execution of a consequence -- I *think* it's during an event
expiration, but I can't swear to that.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-troubleshooting-rules-Drools-tp3469285p3471173.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Live Queries and Expired Events

2011-11-01 Thread Robert Crawford
Well, the live query is started *before* any events get inserted, and I have
a ViewChangedEventListener registered to listen to that query. I expected to
see rowRemoved() called every time an event is expired, but instead only see
it happening *MOST* of the time.

For example, I have 5000 events inserted. The ViewChangedEventListener
updates the corresponding database row as the events expire. I shut off the
event feed (so nothing new is going into either the database or the session)
and over time the events expire. I can watch the database being updated as
the events expire, but then the number flattens out to 50-60 or so that just
haven't been touched.

As I understand it, expiration happens even if the event matches the
conditions for a rule, so they're not being retained for that reason,
right?

Oh, and when I've had the system down for a while and I'm receiving a
backlog of events, they simply seem to disappear on insertion. I haven't
traced the path of execution yet, though.


--
View this message in context: 
http://drools.46999.n3.nabble.com/Live-Queries-and-Expired-Events-tp3469198p3471214.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Live Queries and Expired Events

2011-11-01 Thread Robert Crawford
My terms are likely incorrect, but:

-
Section 4.3.3.2.2. Live Querries:

We have now complimented this with Live Querries, which has a listener
attached instead of returning an iterable result set. These live querries
stay open creating a view and publish change events for the contents of this
view. So now you can execute your query, with parameters and listen to
changes in the resulting view.
-

The listener is not being called for every event, as I'd expect it to be
called.


--
View this message in context: 
http://drools.46999.n3.nabble.com/Live-Queries-and-Expired-Events-tp3469198p3471324.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help with troubleshooting rules/Drools

2011-11-01 Thread Robert Crawford
They can recalculate just fine -- the underlying AccumulateData is just a
SortedSet -- but ISTR there are problems with that code outside of my
functions.


--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-troubleshooting-rules-Drools-tp3469285p3471330.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Preventing re-evaluation on modification of 'output' fact

2011-11-01 Thread Robert Crawford
Have you considered making the reasons for being suspicious objects in their
own right and inserting them independently? Let's say:

SuspectedFraudReason (abstract parent class)
TransactionsTooOften (extends SuspectedFraudReason)
TransactionsTooHigh (extends SuspectedFraudReason)

then indicate the reasons by inserting a new instance of an object, rather
than modifying your results object. If you have rules that depend on other
indicators of fraud, then they only get evaluated when that particular class
of SuspectedFraudReason is inserted, rather than every time you modify the
results object.

At the end, you can use a query() to collect all the reasons.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Preventing-re-evaluation-on-modification-of-output-fact-tp3455022p3472137.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Live Queries and Expired Events

2011-10-31 Thread Robert Crawford
I have a live query that should match *all* the events I insert. However,
it's apparently not being called for a large number of them. It appears that
if an event is expired at the time of insert, it's not tripping the
rowRemoved part of the query.

Is this the expected behavior? If so, is there some way to catch this
condition?

Thanks!


--
View this message in context: 
http://drools.46999.n3.nabble.com/Live-Queries-and-Expired-Events-tp3469198p3469198.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help with troubleshooting rules/Drools

2011-10-31 Thread Robert Crawford
Any advice on how to troubleshoot problems? I have a fairly simple set of
rules (a couple dozen), but keep having problems with fatal exceptions. The
most recent was:

org.drools.RuntimeDroolsException: Unexpected exception executing action
org.drools.reteoo.PropagationQueuingNode$PropagateAction@1e60aa7
 at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:977)
 at
org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1231)
 at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:753)
 at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:729)
 at
org.drools.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:234)
 at
com.kroger.tempmonitor.app.service.RuleService$1.run(RuleService.java:214)
 at java.lang.Thread.run(Thread.java:662)
Caused by: java.util.NoSuchElementException
 at java.util.LinkedList.remove(LinkedList.java:788)
 at java.util.LinkedList.removeFirst(LinkedList.java:134)
 at
org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:264)
 at
org.drools.reteoo.PropagationQueuingNode$AssertAction.execute(PropagationQueuingNode.java:357)
 at
org.drools.reteoo.PropagationQueuingNode.propagateActions(PropagationQueuingNode.java:238)
 at
org.drools.reteoo.PropagationQueuingNode$PropagateAction.execute(PropagationQueuingNode.java:502)
 at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:975)
 ... 6 more


No mention of a rule name, so where do I begin?

My architecture is simple: one thread ran fireUntilHalt(), other (multiple)
threads inserting objects. Should I synchronize on the session so only one
thread is inserting at a time?

There's one rule that triggers a large number of inserts, and it used to
give me problems, but I've moved those inserts into Commands and those
problems seem to have gone away.

Any advice would be welcome, no matter how basic you think it is! Thanks!


--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-troubleshooting-rules-Drools-tp3469285p3469285.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] JBRULES-3260: Events forced to zero expirationOffset

2011-10-22 Thread Robert Crawford
It seems like ever since I found this, I can't stop tripping this condition.

Basically, while adding the DRL files to the KnowledgeBuilder,
ReteooRuleBase decides it has to reconcile event definitions from different
packages, so it looks for any that are assignable. At first I thought this
was just a guard against having a parent expire quicker than a child class
and breaking rules for the child. But now I'm getting this condition for A
SINGLE CLASS WITH NO INHERITANCE.

At the root of the problem is ReteooRuleBase line 477:
node.setExpirationOffset( Math.max( node.getExpirationOffset(),
typeDeclaration.getExpirationOffset()+1 ) );

Since neither node nor typeDeclaration have declared expirations, they both
have expirationOffset values of -1. The code evaluates:

max(-1, -1 + 1)

sets the expirationOffset for node to zero, and from then on my objects are
expired literally as I insert them.

If someone could more clearly state the conditions that trip this code, I'd
do my best to avoid them. I've already eliminated inheritance among my
events, but that doesn't seem to be enough. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/JBRULES-3260-Events-forced-to-zero-expirationOffset-tp3444069p3444069.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Caching RuleBase in Drools

2008-08-11 Thread Robert Crawford


On Aug 11, 2008, at 9:30 AM, Ingomar Otter wrote:

 Typically, a rulebase would be generated and cached on first use;  
to save
on the continually re-generation of the Rule Base; which is  
expensive.
Read:   Cache the rulebase (the rulebase object) with a Cache  
mechanism of your choice.


AFAIK there is no dedicated caching mechanism in Drools per se.
This makes sense, otherwise the next person would look for cache  
distribution, cache synchronization in a cluster. A can of worms  
that should not be touched.


For example we use JBOSS TreeCache and are happy with it. This may  
be overkill, simpler implementations  like oscache may just be fine  
- all depends on your requirements and deployment situation.


I've just been using a singleton for the moment, tossing it and  
rebuilding when the rules change. Works OK.


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Parameterized Queries?

2007-09-05 Thread Robert Crawford
Does anyone know how to use parameterized queries? I'm trying to retrieve
ONLY the results for a single installation, with a query like this:

query find errors for site
validationError: ValidationError(this.siteId == $1)
end

QueryResults results = session.getQueryResults(find errors for site, new
Object[] {siteId});

I get the error

org.drools.RuntimeDroolsException: Exception executing predicate
org.drools.base.mvel.MVELPredicateExpression

Caused by: org.mvel.PropertyAccessException: unable to resolve property: $1

I'm pretty sure I'm not writing the rule correctly in the DRL; does anyone
know the correct syntax? The manual isn't clear on this.

Thanks!

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Parameterized Queries?

2007-09-05 Thread Robert Crawford


On Sep 5, 2007, at 2:19 PM, Edson Tirelli wrote:



   I think Mark just updated documentation for that and it will be  
included in 4.0.2.

   Meanwhile:

query find errors for site( int $param1, String $param2, ...)
validationError: ValidationError( this.siteId == $param1)
end

   Parameter type is optional, and you can have as many parameters  
as you need.


Thanks! That worked perfectly!



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Functionality/Performance Test Results

2007-08-23 Thread Robert Crawford
Our users are asking to be able to specify custom validations in our
application. I've been undecided whether to use a rules engine or write
our own dynamic validation code.

While it's admittedly still in the toy problem stage, I tried using
drools in place of some existing hand-coded validation. The drools version
took the SAME amount of time.

Then I added another rule, to simulate the types of validations our users
want to add, and re-ran.

Again, SAME time.

Admittedly, database access was the big time consumer -- average of 6
seconds per unit of work, and about 15 units of work per test -- but it
was the same for both the rules-based and hand-coded validations.

Excellent work, everyone! You've made my life much, much simpler!



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users