Return-Path: Delivered-To: apmail-servicemix-dev-archive@www.apache.org Received: (qmail 36973 invoked from network); 2 Sep 2008 07:36:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Sep 2008 07:36:52 -0000 Received: (qmail 71606 invoked by uid 500); 2 Sep 2008 07:36:50 -0000 Delivered-To: apmail-servicemix-dev-archive@servicemix.apache.org Received: (qmail 71589 invoked by uid 500); 2 Sep 2008 07:36:50 -0000 Mailing-List: contact dev-help@servicemix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@servicemix.apache.org Delivered-To: mailing list dev@servicemix.apache.org Received: (qmail 71578 invoked by uid 99); 2 Sep 2008 07:36:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Sep 2008 00:36:50 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Sep 2008 07:35:51 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A0280234C1C6 for ; Tue, 2 Sep 2008 00:35:52 -0700 (PDT) Message-ID: <1772792855.1220340952654.JavaMail.jira@brutus> Date: Tue, 2 Sep 2008 00:35:52 -0700 (PDT) From: "Gert Vanthienen (JIRA)" To: dev@servicemix.apache.org Subject: [jira] Resolved: (SM-1524) Fix for Memory Leak in ServiceMix-Drools4 DroolsEndpoint In-Reply-To: <713799471.1219765792606.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/SM-1524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gert Vanthienen resolved SM-1524. --------------------------------- Resolution: Fixed > Fix for Memory Leak in ServiceMix-Drools4 DroolsEndpoint > -------------------------------------------------------- > > Key: SM-1524 > URL: https://issues.apache.org/activemq/browse/SM-1524 > Project: ServiceMix > Issue Type: Bug > Components: servicemix-drools > Affects Versions: 3.2.1 > Reporter: Roman Stumm > Assignee: Gert Vanthienen > Fix For: 3.3 > > > There is a memory leak in class org.apache.servicemix.drools.DroolsEndpoint, because the StatefulSession object must be released, otherwise the drools rulebase keeps a reference to it. > (Description see drools docu: > http://downloads.jboss.com/drools/docs/4.0.7.19894.GA/html_single/index.html#d0e900 > Chapter 2.5.5 > The StatefulSession extends the WorkingMemory class. It simply adds async methods and a dispose() method. The ruleBase retains a reference to each StatefulSession is creates, so that it can update them when new rules are added, dispose() is needed to release the StatefulSession reference from the RuleBase, without it you can get memory leaks. > ) > Here is the fix: (replace methods drools() and createWorkingMemory() with those in org.apache.servicemix.drools.DroolsEndpoint) > protected void drools(MessageExchange exchange) throws Exception { > StatefulSession memory = createWorkingMemory(exchange); > try { > populateWorkingMemory(memory, exchange); > memory.fireAllRules(); > } finally { > memory.dispose(); > } > } > > protected StatefulSession createWorkingMemory(MessageExchange exchange) throws Exception { > return ruleBase.newStatefulSession(); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.