<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Se the currentContext ClassLoader to null, when initialising the knowledge base. Then reset it after you are done.<div><br></div><div>Mark<br><div><div>On 2 Apr 2014, at 08:04, Romain Thouvenin &lt;<a href="mailto:romain.thouvenin@amadeus.com">romain.thouvenin@amadeus.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><font size="2" face="sans-serif">Before asking for an upgrade to this third
party, I did a test.</font>
<br><font size="2" face="sans-serif">I managed to assemble a build of the
component using Drools 5.6.0.Final, and tried to use-and-redeploy my webapp.</font>
<br>
<br><font size="2" face="sans-serif">I did not face any problem due to the
upgrade, but it seems the leak is still there.</font>
<br><font size="2" face="sans-serif">Out of the two instances of CompositeClassLoader
that I could see with 5.2.1, one has gone so it is going in the good direction.</font>
<br><font size="2" face="sans-serif">But there is still one that prevents
garbage collection.</font>
<br>
<br><font size="2" face="sans-serif">The CompositeClassLoader is given the
webapp class loader instance when it is instantiated by RuleBaseConfiguration:</font>
<br>
<br><font size="2" face="sans-serif">&nbsp; &nbsp;ClassLoaderUtil.getClassLoader(ClassLoader[],
Class&lt;?&gt;, boolean) line: 43 &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font size="2" face="sans-serif">&nbsp; &nbsp;at RuleBaseConfiguration.setClassLoader(ClassLoader...)
line: 945 &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font size="2" face="sans-serif">&nbsp; &nbsp;at RuleBaseConfiguration.init(Properties,
ClassLoader...) line: 421 &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font size="2" face="sans-serif">&nbsp; &nbsp;at RuleBaseConfiguration.&lt;init&gt;()
line: 267 &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font size="2" face="sans-serif">&nbsp; &nbsp;at RuleBaseConfiguration.&lt;clinit&gt;()
line: 175 &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br>
<br>
<br><font size="2" face="sans-serif">Any work-around available in 5.6?</font>
<br>
<br><font size="2" face="sans-serif">Thanks,</font>
<br><font size="2" face="sans-serif">Romain</font>
<br>
<br>
<br>
<br>
<br>
<br><font size="1" color="#5f5f5f" face="sans-serif">From: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size="1" face="sans-serif">Mark Proctor &lt;<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt;</font>
<br><font size="1" color="#5f5f5f" face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size="1" face="sans-serif">Rules Users List &lt;<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;,
</font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size="1" face="sans-serif">01/04/2014 19:38</font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size="1" face="sans-serif">Re: [rules-users]
Memory leak due CompositeClassLoader</font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Sent by: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size="1" face="sans-serif"><a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a></font>
<br>
<hr noshade="">
<br>
<br>
<br><font size="3">There were a lot of fixes around this and other areas.
Please upgrade to 5.6, then come back if you have problems.</font>
<br>
<br><font size="3">Mark</font>
<br><font size="3">On 1 Apr 2014, at 14:24, Romain Thouvenin &lt;</font><a href="mailto:romain.thouvenin@amadeus.com"><font size="3" color="blue"><u>romain.thouvenin@amadeus.com</u></font></a><font size="3">&gt;
wrote:</font>
<br>
<br><font size="2" face="Arial">Hello,</font><font size="3"> <br>
</font><font size="2" face="Arial"><br>
I am working on a Web application that uses a third-party component that
uses Drools 5.2.1 (I know this is old, but this is not my choice).</font><font size="3">
</font><font size="2" face="Arial"><br>
While investigating memory leaks in my application, I found out that after
redeploying the webapp in the application server (Weblogic), the leaking
class loader is referenced by:</font><font size="3"> <br>
</font><font size="2" face="Arial"><br>
 &nbsp; org.drools.util.CompositeClassLoader.classLoaders</font><font size="3">
<br>
</font><font size="2" face="Arial"><br>
This is because when that class is instantiated by org.drools.util.ClassLoaderUtil,
the initial list of class loaders includes the context class loader of
the current thread, which is the class loader of my webapp. But the class
loader of CompositeClassLoader is not the same as my webapp, so when I
redeploy my webapp CompositeClassLoader continues to exist and keep that
reference to the webapp class loader, which is therefore never garbage-collected.</font><font size="3">
<br>
</font><font size="2" face="Arial"><br>
Browsing a bit through the code, I see no reference to CompositeClassLoader.removeClassLoader
that could remove the faulty reference.</font><font size="3"> <br>
</font><font size="2" face="Arial"><br>
So my questions are:</font><font size="3"> </font><font size="2" face="Arial"><br>
1) Is my investigation correct?</font><font size="3"> <br>
</font><font size="2" face="Arial"><br>
2) I found this thread on the list: </font><a href="http://drools.46999.n3.nabble.com/permgen-leak-td4027038i20.html"><font size="2" color="blue" face="Arial"><u>http://drools.46999.n3.nabble.com/permgen-leak-td4027038i20.html</u></font></a><font size="3">
</font><font size="2" face="Arial"><br>
Is this the same issue as mine, meaning that it is fixed in 5.6.0 and 6.0?</font><font size="3">
</font><font size="2" face="Arial"><br>
If yes, pushing this third-party component to upgrade is really the only
solution I have?</font><font size="3"> <br>
</font><font size="2" face="Arial"><br>
I am not at all a knowledgeable user of drools, I just happen to be user
of that third-party component, that is why I wanted confirmation of my
findings.</font><font size="3"> <br>
</font><font size="2" face="Arial"><br>
Thanks for your help!</font><font size="3"> </font><font size="2" face="Arial"><br>
Romain</font><font size="3"> <br>
<br>
_______________________________________________<br>
rules-users mailing list</font><font size="3" color="blue"><u><br>
</u></font><a href="mailto:rules-users@lists.jboss.org"><font size="3" color="blue"><u>rules-users@lists.jboss.org</u></font></a><font size="3"><br>
</font><a href="https://lists.jboss.org/mailman/listinfo/rules-users"><font size="3">https://lists.jboss.org/mailman/listinfo/rules-users</font></a>
<br><tt><font size="2">_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
</font></tt><a href="https://lists.jboss.org/mailman/listinfo/rules-users"><tt><font size="2">https://lists.jboss.org/mailman/listinfo/rules-users</font></tt></a>
<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-users</blockquote></div><br></div></body></html>