<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">No, for a CEP engine this is one of the
      most serious types of problems.<br>
      It's possible for an engine to be overloaded, but if this is the
      behavior,<br>
      a sporadic event burst could be used to blow up the execution.<br>
      I suspect slower CPUs may incur this problem at much lower <br>
      insertion/expiration rates,<br>
      I'll raise a killer JIRA and request a more graceful fail
      mechanism in 5.x.<br>
      Good news is, 6.x may be able to deal with these issues much
      better.<br>
      Thanks!<br>
      <br>
      <br>
      On 05/04/2013 09:59 AM, Jason Barto wrote:<br>
    </div>
    <blockquote
cite="mid:CAApekVco2xibq3nLLjqvE=F9gcPrPXBJ1x50Rnu2fxu59j+HiQ@mail.gmail.com"
      type="cite">Wolfgang,
      <div>I'd agree with you although I will continue to research
        further. &nbsp;If it is as you suggest - a race condition - I would
        think a more appropriate reaction of the system would be to emit
        a warning that events are expiring before they can be considered
        by the rules engine, although I&nbsp;would think that this is a use
        case which does not see much real life execution. &nbsp;Thank you
        very much for your time and input into this matter, it's been
        educational.</div>
      <div><br>
      </div>
      <div>Sincerely,<span></span></div>
      <div>Jason<br>
        <br>
        On Saturday, May 4, 2013, Wolfgang Laun wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">I can
          confirm that (using 5.5.0) this NPE occurs predictably with a<br>
          limit of 500000.<br>
          <br>
          It looks like a race condition to me - at least that is what
          line<br>
          DefaultAgenda.java:1319 suggests. Possibly it is due to
          automatic<br>
          retraction "overtaking" rule firing, since the latter tends to
          take<br>
          much, much longer than the ~10sec the mere insertion of 500K
          events<br>
          takes on my system.<br>
          <br>
          500,000 inserted in 10s means 50,000/s, and that, in turn,
          implies<br>
          50,000 retractions per second. &nbsp;30s after the last insertion,
          only<br>
          ~90,000 firings have taken place. (I added a printout of the
          counter's<br>
          total after the Thread.sleep().)<br>
          <br>
          It's interesting to experiment with the @expires value:
          Everything<br>
          else remaining the same, a setting of @expires(10s) will let
          the<br>
          firings complete without a NPE.<br>
          <br>
          So, I'm back to my surmise: a race condition, due to expiry
          being cut<br>
          too short to cope with the system load. I'd still classify
          this as a<br>
          Drools bug: it should notice that it is being overtaxed and/or<br>
          destabilizing itself.<br>
          <br>
          -W<br>
          <br>
          <br>
          On 04/05/2013, Jason Barto &lt;<a moz-do-not-send="true">jason.p.barto@gmail.com</a>&gt;
          wrote:<br>
          &gt; Wolfgang,<br>
          &gt; thank you for your prompt reply. &nbsp;After further work with
          my code I think<br>
          &gt; the culprit may have either been the setting of the event
          expiration time<br>
          &gt; to 1s OR that I was using session.update to insert a new
          counter object;<br>
          &gt; but maybe not. &nbsp;I cleaned up my code in order to send it
          out. &nbsp;In doing so<br>
          &gt; I also downloaded the official Drools 5.5 distribution
          (in the previous<br>
          &gt; example I was using the libraries packaged with BRMS).
          &nbsp;Between the code<br>
          &gt; cleanup and the use of the official distro I'm no longer
          experiencing a<br>
          &gt; Consequence Exception.<br>
          &gt;<br>
          &gt; That being said I am still experiencing a NPE when a high
          iteration count.<br>
          &gt; If you take a look at Drools5FusionEval.java, around line
          51 you'll see a<br>
          &gt; variable 'eventLimit'. &nbsp;If set to 500000 it seems to
          pretty reliably kick<br>
          &gt; out the following NPE:<br>
          &gt;<br>
          &gt; Exception in thread "Thread-1"
          java.lang.NullPointerException<br>
          &gt; &nbsp; &nbsp; at<br>
          &gt;
          org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1319)<br>
          &gt; &nbsp; &nbsp; at<br>
          &gt;
          org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1221)<br>
          &gt; &nbsp; &nbsp; at<br>
          &gt;
          org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1434)<br>
          &gt; &nbsp; &nbsp; at<br>
          &gt;
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:755)<br>
          &gt; &nbsp; &nbsp; at<br>
          &gt;
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:731)<br>
          &gt; &nbsp; &nbsp; at<br>
          &gt;
org.drools.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:247)<br>
          &gt; &nbsp; &nbsp; at
          drools5fusioneval.Drools5FusionEval$1.run(Drools5FusionEval.java:47)<br>
          &gt;<br>
          &gt; As I've said I'm still very new to Drools and trying to
          understand better<br>
          &gt; how it does what it does - any information that anyone
          can provide to help<br>
          &gt; me understand why the above error is being experienced
          would be greatly<br>
          &gt; appreciated.<br>
          &gt;<br>
          &gt; Source code and rules are attached.<br>
          &gt;<br>
          &gt; Sincerely,<br>
          &gt; Jason<br>
          &gt;<br>
          &gt;<br>
          &gt; On Sat, May 4, 2013 at 7:58 AM, Wolfgang Laun<br>
          &gt; &lt;<a moz-do-not-send="true">wolfgang.laun@gmail.com</a>&gt;wrote:<br>
          &gt;<br>
          &gt;&gt; Works for me (5.5.0, 5.4.0) - at least based on the
          code you've posted<br>
          &gt;&gt; which (apart from the omitted getters and setters)
          isn't the one you've<br>
          &gt;&gt; been running, and so you may have changed or omitted
          something<br>
          &gt;&gt; that's essential.<br>
          &gt;&gt;<br>
          &gt;&gt; The full stack dump might shed some more light on
          this, and the full and<br>
          &gt;&gt; true code of the rule RHS whre the NPE is caused.<br>
          &gt;&gt;<br>
          &gt;&gt; -W<br>
          &gt;&gt;<br>
          &gt;&gt; On 04/05/2013, Jason Barto &lt;<a
            moz-do-not-send="true">jason.p.barto@gmail.com</a>&gt;
          wrote:<br>
          &gt;&gt; &gt; I am new to Drools (Expert and Fusion) and have
          been reading through<br>
          &gt;&gt; &gt; the<br>
          &gt;&gt; &gt; materials over the last few days. &nbsp;After going
          through some of the<br>
          &gt;&gt; tutorial<br>
          &gt;&gt; &gt; code I wrote a very quick and dirty to perform a
          base assessment of the<br>
          &gt;&gt; &gt; speed of Fusion / Expert. &nbsp;My code is below.
          &nbsp;The strange thing I'm<br>
          &gt;&gt; &gt; currently receiving is, if I insert 100k events
          the test completes<br>
          &gt;&gt; &gt; successfully, if I insert 150k events, I receive
          a ConsequenceException<br>
          &gt;&gt; &gt; caused by an NPE. &nbsp;Being new to Drools I must be
          doing something wrong,<br>
          &gt;&gt; can<br>
          &gt;&gt; &gt; anyone please provide some guidance?<br>
          &gt;&gt; &gt;<br>
          &gt;&gt; &gt; (Main function)<br>
          &gt;&gt; &gt; Counter cc = new Counter ();<br>
          &gt;&gt; &gt; session.insert (cc);<br>
          &gt;&gt; &gt; for (int i = 0; i &lt; 150000; i++) {<br>
          &gt;&gt; &gt; &nbsp; entryPoint01.insert (new MyEvent ());<br>
          &gt;&gt; &gt; }<br>
          &gt;&gt; &gt;<br>
          &gt;&gt; &gt; (Counter Class)<br>
          &gt;&gt; &gt; public class Counter {<br>
          &gt;&gt; &gt; &nbsp; private long total = 0;<br>
          &gt;&gt; &gt; &nbsp; // get / set total<br>
          &gt;&gt; &gt; &nbsp; public void addValue (int val) {<br>
          &gt;&gt; &gt; &nbsp; &nbsp; total += val;<br>
          &gt;&gt; &gt; &nbsp; }<br>
          &gt;&gt; &gt; }<br>
          &gt;&gt; &gt;<br>
          &gt;&gt; &gt; (MyEvent Class)<br>
          &gt;&gt; &gt; public class MyEvent {<br>
          &gt;&gt; &gt; &nbsp; private int value = 1;<br>
          &gt;&gt; &gt; &nbsp; // get / set value<br>
          &gt;&gt; &gt; }<br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
    </blockquote>
    <br>
  </body>
</html>