<!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">
ok, that might be it. We generate code in a singleton classloader, I
suspect that each thread is generating its' own getters. I suspect that
created singleton classloader is not getting GCd and releasing the perm
gen. I'm not sure how to fix this. You can check this yourself by
attaching a jprofiler instance (available for free trial) and looking
at the object counts.<br>
<br>
I've tracked down the concurrency issue. The Rete node has a HashMap of
ObjectTypeNodes that is built on the fly, that was global to the
rulebase. I'll have to make it local to the working Memory. I'll fix
that today.<br>
<br>
Mark<br>
s erel wrote:
<blockquote
 cite="mid:1a1500b50707040618k561aa016w3f4d48e0b3c7f0c5@mail.gmail.com"
 type="cite">
  <div>Our server creates hundreds of stateful rule sessions
concurrently. Each created rule seesion is specific to a thread. We did
not encounter </div>
  <div>any memory problems with the previous version. As I've said,
it's&nbsp;difficult (actually, impossible) for me to provide you with a self
contained example </div>
  <div>since&nbsp;the drl is&nbsp;complicated and contains&nbsp;dozens of complex
objects. However, I am ready to provide you with any information that
can help</div>
  <div>us in that manner.</div>
  <div>I've also mentioned in the earlier threads the concurrency
problem I've encountered with AbstractHashTable. </div>
  <div>Can this has something to do with it?</div>
  <div><br>
&nbsp;</div>
  <div><span class="gmail_quote">On 7/4/07, <b class="gmail_sendername">Mark
Proctor</b> &lt;<a moz-do-not-send="true"
 href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt;
wrote:</span>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
    <div text="#000000" bgcolor="#ffffff">I don't beleive there is
anything in 4.0 that is going to cause such quick loss of permgen. Can
you create a self contained example that illustrates this behaviour? So
we can reproduce this?
    <br>
    <span class="sg"><br>
Mark</span>
    <div><span class="e" id="q_1139121159cb6e46_2"><br>
s erel wrote:
    <blockquote type="cite">
      <div>We've tried to increase the permGen to 256mb. It did not
help and the space run out really fast.</div>
      <div>Regarding MVEL, is turning&nbsp;code generation off&nbsp;something
that can (or will)&nbsp;be done&nbsp;with a configuration parameter/factory
method or do I need to track down all the places in the code?</div>
      <div>&nbsp;</div>
      <div>We did not experience such memory behavior with the previous
version we used (3.06) when running&nbsp;the same tests.</div>
      <div>Bugs in 3.06&nbsp;(no longer present in 4M3)&nbsp;are forcing us to
upgrade.</div>
      <div>&nbsp;</div>
      <div>Is there another reason for such behaviour?</div>
      <div>Should we wait for release candidate?</div>
      <div><br>
&nbsp;</div>
      <div><span class="gmail_quote">On 7/4/07, <b
 class="gmail_sendername">Mark Proctor</b> &lt;<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org
      </a>&gt; wrote:</span>
      <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
        <div text="#000000" bgcolor="#ffffff">increase your perm gen
space,or use the MVEL dialect with code generation off.
        <div><span><br>
        <br>
Mark<br>
s erel wrote:
        <blockquote type="cite">
          <div>Hello,</div>
          <div>&nbsp;</div>
          <div>During capacity tests we've received permGen OOM
exception.&nbsp;The occupied space&nbsp;in the permGen area increases rapidly.
Any opinions?</div>
          <br>
          <br>
          <div><span class="gmail_quote">On 7/3/07, <b
 class="gmail_sendername">s erel</b> &lt;<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:erelsagi@gmail.com" target="_blank">erelsagi@gmail.com</a>&gt;
wrote: </span>
          <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
            <div>In&nbsp;our project we are&nbsp;creating a
StatefulRuleSession&nbsp;and saving it in a per-thread context (i.e. Each
thread has it's own StatefulRuleSession):</div>
            <div>&nbsp;</div>
            <div>ruleServiceProvider.getRuleRuntime().createRuleSession(contextName,
properties, RuleRuntime.STATEFUL_SESSION_TYPE);</div>
            <div>&nbsp;</div>
            <div>When a thread session ends, we are calling release on
the previously created StatefulRuleSession.</div>
            <div>&nbsp;</div>
            <div>&nbsp;</div>
            <div>Changing the following lines:</div>
            <div>&nbsp;</div>
            <div>
            <p>public abstract class AbstractHashTable<br>
&nbsp;&nbsp;</p>
            <p>...</p>
            <p>&nbsp;&nbsp;&nbsp; public Iterator iterator() {<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( this.iterator == null ) {<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.iterator = new HashTableIterator( this );<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
//<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.iterator.reset();<br>
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return this.iterator;</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HashTableIterator iterator = new
HashTableIterator(this);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iterator.reset();</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return iterator;<br>
&nbsp;&nbsp;&nbsp; }</p>
Seems to solve the problem I've encountered. What's your opinion?<br>
            <br>
&nbsp;</div>
            <div><span>
            <div><span class="gmail_quote">On 7/2/07, <b
 class="gmail_sendername">Mark Proctor</b> &lt;<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org
            </a>&gt; wrote:</span>
            <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
              <div text="#000000" bgcolor="#ffffff">a working memory
should be single threaded, so not sure how this could be a race
condition?<br>
              <span><br>
Mark</span>
              <div><span><br>
s erel wrote:
              <blockquote type="cite">
                <div>I've done a little debugging. The code fails
in&nbsp;the following segment:</div>
                <div>&nbsp;</div>
                <div>public static class HashTableIterator</div>
                <div>...</div>
                <div>&nbsp;while ( this.entry == null ) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.row++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( this.row == this.length ) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return null;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.entry = this.table[this.row]; <strong>//
---&gt; index out of bounds exception</strong><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div>
                <div>}<br>
&nbsp;</div>
                <div>this.row has the same value as this.length despite
the condition above it. Probably a race condition issue.</div>
                <div><br>
&nbsp;</div>
                <div><span class="gmail_quote">On 7/2/07, <b
 class="gmail_sendername">Mark Proctor</b> &lt;<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org
                </a>&gt; wrote:</span>
                <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
                  <div text="#000000" bgcolor="#ffffff">Not really :(<br>
                  <br>
In your situation I tend to keep removing rules and data while still
making sure the error happens, to get it down to a minimum. Please do
try, as this isn't an error that should happen. Or alterntaively you
can open drools-core and drools-compiler in eclipse and execuse and
debug this yourself - in your situation this might best. you can put in
a breakpoint to listen for that particular exception. <br>
                  <span><br>
Mark</span>
                  <div><span><br>
s erel wrote:
                  <blockquote type="cite">
                    <div>It's hard for me to provide a self contained
project. The drl is&nbsp;long and&nbsp;uses several business objects. It's the
same drl as we've been using for 306 minus the keyword changes. </div>
                    <div>Is there anything else i can check or provide
you in order to solve this matter.</div>
                    <div>&nbsp;</div>
                    <div>Thanks<br>
&nbsp;</div>
                    <div><span class="gmail_quote">On 7/1/07, <b
 class="gmail_sendername">Mark Proctor</b> &lt;<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org
                    </a>&gt; wrote:</span>
                    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
                      <div text="#000000" bgcolor="#ffffff">Can you
provide us a self contained project which creates this error? Unless we
can recreate it, it will be very hard to track it down. Please attach
the project to a jira and we'll make it a priority. <br>
                      <br>
Mark<br>
s erel wrote:
                      <blockquote type="cite">
                        <div><span>
                        <div>Hello,</div>
                        <div>&nbsp;</div>
                        <div>I've just started integrating&nbsp;MR3&nbsp;into my
project (I've previously used&nbsp;3.06).&nbsp;The drl&nbsp;compiles and everything
seems fine, but during </div>
                        <div>tests the following exception is thrown
for time to time:</div>
                        <div>&nbsp;</div>
                        <div>java.lang.ArrayIndexOutOfBoundsException:
17<br>
&nbsp;at
org.drools.util.AbstractHashTable$HashTableIterator.next(AbstractHashTable.java:250)<br>
&nbsp;at org.drools.reteoo.Rete$ObjectTypeConf.buildCache(Rete.java:434)<br>
&nbsp;at
org.drools.reteoo.Rete$ObjectTypeConf.getObjectTypeNodes(Rete.java:425)<br>
&nbsp;at org.drools.reteoo.Rete.assertObject(Rete.java:172)<br>
&nbsp;at
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)<br>
&nbsp;at
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute
(ReteooWorkingMemory.java:163)<br>
&nbsp;at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1135)<br>
&nbsp;at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:781)<br>
&nbsp;at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:584)<br>
&nbsp;at
org.drools.jsr94.rules.StatefulRuleSessionImpl.addObject(StatefulRuleSessionImpl.java:162)</div>
                        <div>&nbsp;</div>
                        <div>This only happens during high load tests.</div>
                        <div>Can anyone help me?</div>
                        <div>&nbsp;</div>
                        <div>Thanks</div>
                        <div>&nbsp;</div>
                        </span></div>
                        <pre><hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
                      </blockquote>
                      <br>
&nbsp;</div>
                      <br>
_______________________________________________<br>
rules-users mailing list<br>
                      <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org
                      </a><br>
                      <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users </a><br>
                      <br>
                    </blockquote>
                    </div>
                    <br>
                    <pre><hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
                  </blockquote>
                  <br>
                  </span></div>
                  </div>
                  <br>
_______________________________________________<br>
rules-users mailing list<br>
                  <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
                  <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users </a><br>
                  <br>
                </blockquote>
                </div>
                <br>
                <pre><hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
              </blockquote>
              <br>
              </span></div>
              </div>
              <br>
_______________________________________________<br>
rules-users mailing list<br>
              <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
              <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users </a><br>
              <br>
            </blockquote>
            </div>
            <br>
            </span></div>
          </blockquote>
          </div>
          <br>
          <pre><hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
        </blockquote>
        <br>
        </span></div>
        </div>
        <br>
_______________________________________________<br>
rules-users mailing list<br>
        <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
        <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users </a><br>
        <br>
      </blockquote>
      </div>
      <br>
      <pre><hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
    </blockquote>
    <br>
    </span></div>
    </div>
    <br>
_______________________________________________<br>
rules-users mailing list<br>
    <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
    <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users
    </a><br>
    <br>
  </blockquote>
  </div>
  <br>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
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>