[rules-users] Null pointer when inserting into working memory

Scott Burrows scottjburrows at gmail.com
Sat Oct 17 15:46:38 EDT 2009


Using 4.0.7.

At some random time and after doing literally thousands of inserts and
retracts with no issue I suddenly get this when I do a retract from working
memory:

2009-10-17 13:25:59,511 ERROR [STDERR] Caused by:
java.lang.NullPointerException
2009-10-17 13:25:59,511 ERROR [STDERR]  at
org.drools.base.com.m2syscorp.i24card.rulesengine.facts.CountryGroup648199445$getNum.getValue(Unknown
Source)
2009-10-17 13:25:59,511 ERROR [STDERR]  at
org.drools.base.ClassFieldExtractor.getValue(ClassFieldExtractor.java:127)
2009-10-17 13:25:59,511 ERROR [STDERR]  at
org.drools.base.evaluators.StringFactory$StringEqualEvaluator.evaluate(StringFactory.java:119)
2009-10-17 13:25:59,511 ERROR [STDERR]  at
org.drools.util.AbstractHashTable$SingleIndex.equal(AbstractHashTable.java:552)
2009-10-17 13:25:59,511 ERROR [STDERR]  at
org.drools.util.FactHandleIndexHashTable$FieldIndexEntry.matches(FactHandleIndexHashTable.java:379)
2009-10-17 13:25:59,511 ERROR [STDERR]  at
org.drools.util.FactHandleIndexHashTable.remove(FactHandleIndexHashTable.java:200)
2009-10-17 13:25:59,512 ERROR [STDERR]  at
org.drools.reteoo.JoinNode.retractObject(JoinNode.java:180)
2009-10-17 13:25:59,512 ERROR [STDERR]  at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateRetractObject(CompositeObjectSinkAdapter.java:375)
2009-10-17 13:25:59,512 ERROR [STDERR]  at
org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:189)
2009-10-17 13:25:59,512 ERROR [STDERR]  at
org.drools.reteoo.Rete.retractObject(Rete.java:215)
2009-10-17 13:25:59,512 ERROR [STDERR]  at
org.drools.reteoo.ReteooRuleBase.retractObject(ReteooRuleBase.java:211)
2009-10-17 13:25:59,512 ERROR [STDERR]  at
org.drools.reteoo.ReteooWorkingMemory.doRetract(ReteooWorkingMemory.java:79)
2009-10-17 13:25:59,512 ERROR [STDERR]  at
org.drools.common.AbstractWorkingMemory.retract(AbstractWorkingMemory.java:1023)
2009-10-17 13:25:59,512 ERROR [STDERR]  at
org.drools.common.AbstractWorkingMemory.retract(AbstractWorkingMemory.java:982)
2009-10-17 13:25:59,512 ERROR [STDERR]  at
com.m2syscorp.i24card.rulesengine.engine.RulesEngineThread.WMSyncdInsertRetract(RulesEngineThread.java:496)


It does not happen every time,  just suddenly.   The worst of it is that
working memory is corrupted after that and has to be closed.

I would love to be able to recreated working memory with each transaction
(fireallrules) but it takes too long to create it.  I have to do
transactions very quickly and creating a new stateful session
(workingmemory) takes about 250 - 800 milliseconds.

This just started happening recently after a code change to our app that
increased the number of inserts and retracts per transaction from about 35
to 1600+.

I have 5 different types of objects to be inserted into working memory,
parallel threads query our database for the facts to be inserted.  They all
call the same synchronized method from those threads to RETRACT the previous
transactions facts then INSERT the new facts.

The INSERTS and RETRACTS are done via synchronized method.   The queries
that get a list of fact handles are not.

Could there be an issue where pointers to facts in working memory might be
getting corrupted when INSERTS and RETRACTS are happening elsewhere?

Any help would be appreciated.

Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091017/daa8e0a7/attachment.html 


More information about the rules-users mailing list