I'm trying out stream mode and having some trouble.  I'm setting 
drools.eventProcessingMode to stream and using an entry point for inserting 
some objects.  Sometimes (but not all of the time) the rule that matches on 
objects from the entry point (currently the only rule in the ruleset) will get 
a null reference for the object retrieved from the entry point.  Here's the drl:

declare Incoming
    @role( event )
    @expires( 15s )
end

rule "entry"
no-loop true
when
  i: Incoming() from entry-point "Incoming";
  e: Existing(matcher == i.matcher);
then
  if(i == null) { 
    System.err.println("NULL MATCHED WITH " + e.getMatcher());
  } else {
    if(e.incorporate(i)) {
      update(e);
      System.out.println(e);
    }
  }
end

Sometimes (not not all of the time) I get these in stderr:

NULL MATCHED WITH Matcher1
NULL MATCHED WITH Matcher12
NULL MATCHED WITH Matcher3
NULL MATCHED WITH Matcher9

The Incoming objects are added at a high rate (sometimes thousands per second) 
so my guess was that they weren't being processed fast enough and were being 
expired before the rule action could fire.  I changed their @expires value to 
"1d" and then got one of the two exceptions below when I ran the application. 

Some more details: I use WorkingMemoryEntryPoint.insert() to add the Incoming 
objects.  The StatefulKnowledgeSession runs in a separate thread, blocking on 
fireUntilHalt().  

Here are the exceptions I often incur on calling 
WorkingMemoryEntryPoint.insert() with the long expiration.  Rule execution 
halts after the exception:

Exception in thread "Thread-5" java.lang.NullPointerException
        at org.drools.util.RightTupleList.matches(RightTupleList.java:167)
        at 
org.drools.util.RightTupleIndexHashTable.get(RightTupleIndexHashTable.java:292)
        at 
org.drools.util.RightTupleIndexHashTable.getFirst(RightTupleIndexHashTable.java:87)
        at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:112)
        at 
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)
        at 
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:28)
        at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:175)
        at 
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
        at 
org.drools.reteoo.PropagationQueuingNode$AssertAction.execute(PropagationQueuingNode.java:326)
        at 
org.drools.reteoo.PropagationQueuingNode.propagateActions(PropagationQueuingNode.java:221)
        at 
org.drools.reteoo.PropagationQueuingNode$PropagateAction.execute(PropagationQueuingNode.java:394)
        at 
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1464)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:156)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:120)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:78)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:26)
        at org.gregcode.stuff.analysis.Analyzer.add(Analyzer.java:108)
        at org.gregcode.stuff.Simulator$1.run(Simulator.java:69)
        at java.lang.Thread.run(Thread.java:619)

Exception in thread "Thread-3" java.lang.NullPointerException                   
                                                                                
            
        at org.drools.util.LeftTupleList.add(LeftTupleList.java:48)             
                                                                                
            
        at 
org.drools.reteoo.RuleTerminalNode.assertLeftTuple(RuleTerminalNode.java:245)   
                                                                                
 
        at 
org.drools.reteoo.RuleTerminalNode.assertLeftTuple(RuleTerminalNode.java:165)   
                                                                                
 
        at 
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)
                                                     
        at 
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:28)
                                                        
        at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:116)        
                                                                                
            
        at 
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)
                                                     
        at 
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:28)
                                                        
        at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:175)           
                                                                                
            
        at 
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
                                                                 
        at 
org.drools.reteoo.PropagationQueuingNode$AssertAction.execute(PropagationQueuingNode.java:326)
                                                                   
        at 
org.drools.reteoo.PropagationQueuingNode.propagateActions(PropagationQueuingNode.java:221)
                                                                       
        at 
org.drools.reteoo.PropagationQueuingNode$PropagateAction.execute(PropagationQueuingNode.java:394)
                                                                
        at 
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1464)
                                                                    
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:156)   
                                                                                
            
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:120)   
                                                                                
            
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:78)    
                                                                                
            
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:26)    
                                                                                
            
        at org.gregcode.stuff.analysis.Analyzer.add(Analyzer.java:108)          
                                                                                
         
        at org.gregcode.stuff.Simulator$1.run(Simulator.java:69)                
                                                                                
         
        at java.lang.Thread.run(Thread.java:619) 

Thanks!
GreG


      
_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev

Reply via email to