[rules-dev] Exception in runtime

Edson Tirelli tirelli at post.com
Tue Jun 22 12:06:45 EDT 2010


   Tom,

   Looks like a bug and I have an idea why it is happening. Let me do some
investigation here and I will get back to you.

   Meanwhile, feel free to open a ticket to track this or I will do it
myself later.

    Edson

2010/6/22 <Tom.E.Murphy at wellsfargo.com>

>  Mauricio –
>
> Here’s the session set-up and rules code:
>
> *public* *void* processDataWithRules(BeansLoader loader, Object pf,
> GlobalRulesFunctions gf)
>
> *throws* ARGenTDataInsertionException, ARGenTRunTimeException, Exception
>
> {
>
>       StatefulKnowledgeSession ksession = *null*;
>
>       *try*
>
>       {
>
>             *if* (kbase.getKnowledgePackages().size() == 0)
>
>                   *throw* *new* ARGenTRunTimeException("There are no
> knowledge packages (Rules) in the rule base.");
>
>
>
>             ksession = kbase.newStatefulKnowledgeSession();
>
>             gf.setRulesSession(ksession);
>
>             ksession.setGlobal("functions", gf);
>
>
>
>             loader.Load(pf, (StatefulKnowledgeSessionImpl) ksession); //
> see below for code of this load operation
>
>
>
>             *for* (*final* KnowledgePackage kp : kbase
> .getKnowledgePackages())
>
>                   *for* (*final* Process p : kp.getProcesses())
>
>                   {
>
>                         *final* String id = p.getId();
>
>                         *final* Long lId = *new* Long(id);
>
>                         *if* (*this*.topLevelFlowId == 0 ||
> lId.longValue() == *this*.topLevelFlowId)
>
>                               ksession.startProcess(id);
>
>                   }
>
>             ksession.fireAllRules();
>
>
>
>       }
>
>       *catch* (Throwable t)
>
>       {
>
>             *throw* *new* ARGenTRunTimeException(t);
>
>       }
>
>       *finally*
>
>       {
>
>             gf.setRulesSession(*null*);
>
>             *if* (ksession != *null*)
>
>                   ksession.dispose();
>
>       }
>
> }
>
>
>
> And here’s the object insertion code (BeansLoader). It is a recursive
> descent through a hierarchy of XmlBeans objects, inserting the interesting
> objects and suppressing others.
>
>
>
> *public* *void* Load(Object toLoad, StatefulKnowledgeSessionImpl wm) *
> throws* ARGenTDataInsertionException
>
> {
>
>       *try*
>
>       {
>
>             Class c = toLoad.getClass();
>
>             *if* (c.isPrimitive() || Suppress(c.getName()))
>
>                   *return*;
>
>             wm.insert(toLoad); // insert the object into working memory
>
>
>
>             Method[] methods = c.getMethods();
>
>             *for* (Method mIter : methods)
>
>             {
>
>                   *if* (mIter.getParameterTypes().length == 0
>
>                               && mIter.getName().startsWith("get")
>
>                               && !mIter.getName().startsWith("getIsSet")
>
>                               && !mIter.getName().endsWith("Bean"))
>
>                   {
>
>                         *if* (!mIter.getReturnType().isPrimitive()
>
>                               &&
> !Suppress(mIter.getReturnType().getName()))
>
>                         {
>
>                               String testName = "getIsSet" +
> mIter.getName().substring(3);
>
>                               Method mTester = *null*;
>
>                               Method m = *null*;
>
>                               *try*
>
>                               {
>
>                                     m = *c.getMethod(mIter.getName(),**
> null**)*;
>
>                                     mTester = *c.getMethod(testName, **
> null**)*;
>
>                               }
>
>                               *catch* (Throwable t)
>
>                               {
>
>                                     // ignore -- testing for null next
>
>                               }
>
>                               *if* (mTester != *null*)
>
>                               {
>
>                                     Object test = *mTester.invoke(toLoad,
> **null**)*;
>
>                                     Boolean b = *false*;
>
>                                     *if* (test != *null* &&
> test.getClass().isInstance(b))
>
>                                     {
>
>                                           b = (Boolean)test;
>
>                                           *if* (!b)
>
>                                                 *continue*;
>
>                                     }
>
>                               }
>
>                               *if* (m != *null*)
>
>                               {
>
>                                     Object o = *mIter.invoke(toLoad, **
> null**)*;
>
>                                     *if* (o != *null*)
>
>                                     {
>
>                                           *Class* co = o.getClass();
>
>                                           String className =
> co.getCanonicalName();
>
>                                           *if* (className.endsWith("[]")) //
> an array
>
>                                           {
>
>                                                 Object [] os = (Object[])o;
>
>                                                 *for* (Object o1 : os)
>
>                                                 {
>
>                                                       Load(o1,wm);
>
>                                                 }
>
>                                           }
>
>                                           *else* *if* (o *instanceof*ArrayList)
>
>                                           {
>
>                                                 *ArrayList* al = (*
> ArrayList*)o;
>
>                                                 *for* (Object o2 : al)
>
>                                                       Load(o2,wm);
>
>                                           }
>
>                                           *else*
>
>                                           {
>
>                                                 Load(o,wm);
>
>                                           }
>
>                                     }
>
>                               }
>
>                         }
>
>                   }
>
>             }
>
>       }
>
>       *catch*(Throwable t)
>
>       {
>
> *throw* *new* ARGenTDataInsertionException(t);
>
>       }
>
> }
>
>
>
> *Tom Murphy*
>
> Business Process Consultant
> Wells Fargo HCFG - CORE Deal Decisioning Platform*
> *
> 800 S. Jordan Creek Parkway | West Des Moines, IA 50266
> MAC: X2301-01B*
> *Office: 515 324 4853 | Mobile: 515 423 4334
>
> tom.e.murphy at wellsfargo.com
>
> This transmission may contain information that is confidential and/or
> proprietary. If you are not the individual or entity to which it is
> addressed, note that any review, disclosure, copying, retransmission, or
> other use is strictly prohibited. If you received this transmission in
> error, please notify the sender immediately and delete the material from
> your system.
>
>
>
> *From:* rules-dev-bounces at lists.jboss.org [mailto:
> rules-dev-bounces at lists.jboss.org] *On Behalf Of *Mauricio Salatino
> *Sent:* Tuesday, June 22, 2010 9:09 AM
>
> *To:* Rules Dev List
> *Subject:* Re: [rules-dev] Exception in runtime
>
>
>
> I'm not aware about Web Logic, but you can review what exactly are you
> doing the insertion. Can you share with us where do you have your ksession
> (inside a Stateless/Statefull session bean inside weblogic?), how you access
> that session to insert facts, etc.
> Greetings.
>
> On Tue, Jun 22, 2010 at 11:03 AM, <Tom.E.Murphy at wellsfargo.com> wrote:
>
> Maurice –
>
> By design of our runtime components, a single stateful session is owned and
> managed by a single thread. Data is only inserted by that one thread into
> that session.
>
> Unless maybe the Web Logic app server is doing something odd under the
> covers…
>
>
>
> *Tom Murphy*
>
> Business Process Consultant
> Wells Fargo HCFG - CORE Deal Decisioning Platform*
> *
> 800 S. Jordan Creek Parkway | West Des Moines, IA 50266
> MAC: X2301-01B*
> *Office: 515 324 4853 | Mobile: 515 423 4334
>
> tom.e.murphy at wellsfargo.com
>
> This transmission may contain information that is confidential and/or
> proprietary. If you are not the individual or entity to which it is
> addressed, note that any review, disclosure, copying, retransmission, or
> other use is strictly prohibited. If you received this transmission in
> error, please notify the sender immediately and delete the material from
> your system.
>
>
>
> *From:* rules-dev-bounces at lists.jboss.org [mailto:
> rules-dev-bounces at lists.jboss.org] *On Behalf Of *Mauricio Salatino
> *Sent:* Tuesday, June 22, 2010 8:26 AM
> *To:* Rules Dev List
> *Subject:* Re: [rules-dev] Exception in runtime
>
>
>
> Are you inserting facts from different threads in a statefull session?
>
> On Tue, Jun 22, 2010 at 10:21 AM, <Tom.E.Murphy at wellsfargo.com> wrote:
>
> Anybody have any ideas on this?
>
>
>
> We are seeing ConcurrentModificationException while inserting objects into
> working memory. This happens occasionally, either at service start-up, where
> the first transaction is being submitted and the rules are loading for the
> first time, or sometimes under heavy loads with lots of transactions being
> processed by the service:
>
> Drools 5.0.1-GA
>
> AS: Web Logic
>
> JVM: 1.5
>
>
>
> Fragment of stack trace:
>
> Caused by: java.util.ConcurrentModificationException
>
> java.util.HashMap$HashIterator.nextEntry(HashMap.java:2117)
>
> java.util.HashMap$ValueIterator.next(HashMap.java:2147)
>
> org.drools.reteoo.EntryPointNode.updateSink(EntryPointNode.java:285)
>
> org.drools.reteoo.ObjectTypeNode.attach(ObjectTypeNode.java:279)
>
>
> org.drools.reteoo.builder.PatternBuilder.attachObjectTypeNode(PatternBuilder.java:234)
>
> org.drools.reteoo.ClassObjectTypeConf.<init>(ClassObjectTypeConf.java:93)
>
>
> org.drools.common.ObjectTypeConfigurationRegistry.getObjectTypeConf(ObjectTypeConfigurationRegistry.java:58)
>
>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:849)
>
>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)
>
>
> org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:216)
>
> com.wellsfargo.ARGenT.Execution.DefaultLoader.Load(DefaultLoader.java:16)
>
>
>
>
>
> *Tom Murphy
>
> *Business Process Consultant
> Wells Fargo HCFG - CORE Deal Decisioning Platform
>
> 800 S. Jordan Creek Parkway | West Des Moines, IA 50266
> MAC: X2301-01B
> Office: 515 324 4853 | Mobile: 515 423 4334
>
> tom.e.murphy at wellsfargo.com
>
> This transmission may contain information that is confidential and/or
> proprietary. If you are not the individual or entity to which it is
> addressed, note that any review, disclosure, copying, retransmission, or
> other use is strictly prohibited. If you received this transmission in
> error, please notify the sender immediately and delete the material from
> your system.
>
>
>
>
>
>
>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
>
>
> --
> - CTO @ http://www.plugtree.com
> - MyJourney @ http://salaboy.wordpress.com
> - Co-Founder @ http://www.jbug.com.ar
>
> - Salatino "Salaboy" Mauricio -
>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
>
>
> --
> - CTO @ http://www.plugtree.com
> - MyJourney @ http://salaboy.wordpress.com
> - Co-Founder @ http://www.jbug.com.ar
>
> - Salatino "Salaboy" Mauricio -
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20100622/02f0bd43/attachment-0001.html 


More information about the rules-dev mailing list