<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 18/08/2010 00:49, Norman C wrote:
    <blockquote cite="mid:398317.3490.qm@web45316.mail.sp1.yahoo.com"
      type="cite">
      <style type="text/css"><!-- DIV {margin:0px;} --></style>
      <div style="font-family: times new roman,new york,times,serif;
        font-size: 12pt;">
        <div>&nbsp;</div>
        <div>Hi All,</div>
        <div>&nbsp;</div>
        <div>I've posted on this topic twice and logged a JIRA ticket (<a
            moz-do-not-send="true"
            href="https://jira.jboss.org/browse/JBRULES-2651">https://jira.jboss.org/browse/JBRULES-2651</a>)
          as well.&nbsp; I've received no responses and the bug hasn't been
          updated since I logged it.</div>
      </div>
    </blockquote>
    I just replied to the jira. I'm committing the fix now.<br>
    <br>
    Mark<br>
    <blockquote cite="mid:398317.3490.qm@web45316.mail.sp1.yahoo.com"
      type="cite">
      <div style="font-family: times new roman,new york,times,serif;
        font-size: 12pt;">
        <div>&nbsp;</div>
        <div>This is a serious issue as it causes my production system
          to freeze up and it has to be restarted.&nbsp; It's consistently
          reproducible (usually takes a few days).&nbsp; <br>
        </div>
        <div>Can someone please take a quick&nbsp;look at the code?&nbsp; Does the
          call to SingleThreadedObjectStore.addHandle in
          NamedEntryPoint.insert&nbsp;need to be preceded by acquiring the
          lock?</div>
        <div>&nbsp;</div>
        <div>Thanks again for your help.</div>
        <div>&nbsp;</div>
        <div>Norman</div>
        <div style="font-family: times new roman,new york,times,serif;
          font-size: 12pt;"><br>
          <div style="font-family: times new roman,new york,times,serif;
            font-size: 12pt;"><font face="Tahoma" size="2">
              <hr size="1">
              <b><span style="font-weight: bold;">From:</span></b>
              Norman C <a class="moz-txt-link-rfc2396E" href="mailto:rent_my_time@yahoo.com">&lt;rent_my_time@yahoo.com&gt;</a><br>
              <b><span style="font-weight: bold;">To:</span></b>
              <a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
              <b><span style="font-weight: bold;">Sent:</span></b> Wed,
              August 4, 2010 11:23:55 PM<br>
              <b><span style="font-weight: bold;">Subject:</span></b>
              Re: Possible concurrency issue in Drools<br>
            </font><br>
            <div style="font-family: times new roman,new
              york,times,serif; font-size: 12pt;">
              <div>&nbsp;</div>
              <div>I've run into this issue a few more times.&nbsp; Should I
                log a JIRA ticket for this?&nbsp; Any advice would be
                appreciated.</div>
              <div>&nbsp;</div>
              <div>Thanks,</div>
              <div>Norman<br>
              </div>
              <div style="font-family: times new roman,new
                york,times,serif; font-size: 12pt;"><br>
                <div style="font-family: times new roman,new
                  york,times,serif; font-size: 12pt;"><font
                    face="Tahoma" size="2">
                    <hr size="1">
                    <b><span style="font-weight: bold;">From:</span></b>
                    Norman C <a class="moz-txt-link-rfc2396E" href="mailto:rent_my_time@yahoo.com">&lt;rent_my_time@yahoo.com&gt;</a><br>
                    <b><span style="font-weight: bold;">To:</span></b>
                    <a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
                    <b><span style="font-weight: bold;">Sent:</span></b>
                    Sat, July 31, 2010 9:56:26 PM<br>
                    <b><span style="font-weight: bold;">Subject:</span></b>
                    Re: Possible concurrency issue in Drools<br>
                  </font><br>
                  <div style="font-family: times new roman,new
                    york,times,serif; font-size: 12pt;">
                    <div>&nbsp;</div>
                    <div>All,</div>
                    <div>&nbsp;</div>
                    <div>Just wanted to mention, I'm using version 5.0.1
                      of Drools.</div>
                    <div>&nbsp;</div>
                    <div>Thanks,</div>
                    <div>Norman<br>
                    </div>
                    <div style="font-family: times new roman,new
                      york,times,serif; font-size: 12pt;"><br>
                      <div style="font-family: times new roman,new
                        york,times,serif; font-size: 12pt;"><font
                          face="Tahoma" size="2">
                          <hr size="1">
                          <b><span style="font-weight: bold;">From:</span></b>
                          Norman C <a class="moz-txt-link-rfc2396E" href="mailto:rent_my_time@yahoo.com">&lt;rent_my_time@yahoo.com&gt;</a><br>
                          <b><span style="font-weight: bold;">To:</span></b>
                          <a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
                          <b><span style="font-weight: bold;">Sent:</span></b>
                          Sat, July 31, 2010 9:50:19 PM<br>
                          <b><span style="font-weight: bold;">Subject:</span></b>
                          Possible concurrency issue in Drools<br>
                        </font><br>
                        <div style="font-family: times new roman,new
                          york,times,serif; font-size: 12pt;">
                          <div>&nbsp;</div>
                          <div>Hi All,</div>
                          <div>&nbsp;</div>
                          <div>I recently ran into an issue which I
                            believe might point to a concurrency issue.&nbsp;
                            My server stopped processing new requests,
                            so I did a thread dump.&nbsp; In examining the
                            dump, I found that all of the processing
                            threads, save two, were blocking while
                            trying to acquire the lock in
                            NamedEntryPoint.insert.&nbsp;&nbsp;Both of the other
                            two threads appeared to be infinitely
                            looping in the NamedEntryPoint.insert
                            method.&nbsp; Here are snippets of the stack
                            traces:</div>
                          <div>&nbsp;</div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;">ActiveMQ Session Task"
                              prio=10 tid=0x00002aab0003b000 nid=0x7b98
                              runnable
                              [0x000000004c086000..0x000000004c087c90]&nbsp;&nbsp;&nbsp;
                              java.lang.Thread.State: RUNNABLE &nbsp;&nbsp; at
                              org.drools.util.ObjectHashMap.remove(ObjectHashMap.java:121)
                              &nbsp;&nbsp; at
                              org.drools.common.SingleThreadedObjectStore.removeHandle(SingleThreadedObjectStore.java:150)
                              &nbsp;&nbsp;&nbsp;&nbsp; at
                              org.drools.common.NamedEntryPoint.retract(NamedEntryPoint.java:296)
                              &nbsp;&nbsp;&nbsp; at
                              org.drools.common.NamedEntryPoint.retract(NamedEntryPoint.java:245)
                              at
                              org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteExpireAction.execute(ReteooWorkingMemory.java:350)
                              &nbsp;&nbsp;&nbsp;&nbsp; at
                              org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1488)
                              &nbsp;&nbsp;&nbsp;&nbsp; at
                              org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:158)
                              &nbsp;&nbsp;&nbsp;&nbsp; at
                              org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:122)
                              &nbsp; at
                              org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80)
                              &nbsp;&nbsp; at
                              org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28)
                              &nbsp;&nbsp; at </span></div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"></span>&nbsp;</div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"><span
                                style="font-family: 'Courier New';
                                font-size: 11pt;">ActiveMQ Session Task"
                                prio=10 tid=0x000000005a35cc00 nid=0xdf6
                                runnable
                                [0x000000004a268000..0x000000004a269a90]&nbsp;&nbsp;&nbsp;
                                java.lang.Thread.State: RUNNABLE &nbsp;&nbsp; at
                                org.drools.util.AbstractHashTable.resize(AbstractHashTable.java:115)
                                at
                                org.drools.util.ObjectHashMap.put(ObjectHashMap.java:78)
                                &nbsp; at
                                org.drools.common.SingleThreadedObjectStore.addHandle(SingleThreadedObjectStore.java:136)
                                &nbsp;&nbsp;&nbsp;&nbsp; at
                                org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:113)
                                &nbsp;&nbsp;&nbsp;&nbsp; at
                                org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80)
                                &nbsp;&nbsp; at
                                org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28)
                                &nbsp;&nbsp; at </span></span></div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"><span
                                style="font-family: 'Courier New';
                                font-size: 11pt;"></span></span>&nbsp;</div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"><span
                                style="font-family: 'Courier New';
                                font-size: 11pt;"><font face="Times New
                                  Roman" size="3">So it seems like&nbsp;one
                                  while the first thread is holding the
                                  lock and is attempting to remove an
                                  object handle from the object store in
                                  NamedEntryPoint, the other thread is
                                  trying to resize that same object
                                  store in response to an addHandle call
                                  that puts it over the threshold.&nbsp; I
                                  haven't worked out exactly how these
                                  concurrent accesses to the same object
                                  store by two different threads causes
                                  an infinite loop in both threads, but
                                  it seems like the call to
                                  SingleThreadedObjectStore.addHandle
                                  should be preceded by acquiring the
                                  lock.</font></span></span></div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"><span
                                style="font-family: 'Courier New';
                                font-size: 11pt;"></span></span>&nbsp;</div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"><span
                                style="font-family: 'Courier New';
                                font-size: 11pt;"><font face="Times New
                                  Roman" size="3">Is this correct?&nbsp; I
                                  can imagine that resizing a large hash
                                  map could potentially take a long time
                                  and thus synchronizing this call could
                                  impact performance, but somehow, the
                                  action of resizing the table must be
                                  protected in some way from adversely
                                  impacting other operations on the
                                  table.</font></span></span></div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"><span
                                style="font-family: 'Courier New';
                                font-size: 11pt;"></span></span>&nbsp;</div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"><span
                                style="font-family: 'Courier New';
                                font-size: 11pt;"><font face="Times New
                                  Roman" size="3">Any help would be
                                  appreciated.</font></span></span></div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"><span
                                style="font-family: 'Courier New';
                                font-size: 11pt;"></span></span>&nbsp;</div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"><span
                                style="font-family: 'Courier New';
                                font-size: 11pt;"><font face="Times New
                                  Roman" size="3">thanks,</font></span></span></div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"><span
                                style="font-family: 'Courier New';
                                font-size: 11pt;"><font face="Times New
                                  Roman" size="3">Norman</font></span></span></div>
                          <div><span style="font-family: 'Courier New';
                              font-size: 11pt;"><span
                                style="font-family: 'Courier New';
                                font-size: 11pt;"></span></span>&nbsp;</div>
                        </div>
                        <br>
                      </div>
                    </div>
                  </div>
                  <br>
                </div>
              </div>
            </div>
            <br>
          </div>
        </div>
      </div>
      <br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
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>