Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 20369 invoked from network); 30 Mar 2008 07:44:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Mar 2008 07:44:30 -0000 Received: (qmail 28739 invoked by uid 500); 30 Mar 2008 07:44:29 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 28671 invoked by uid 500); 30 Mar 2008 07:44:29 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 28643 invoked by uid 99); 30 Mar 2008 07:44:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Mar 2008 00:44:29 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of joerg.heinicke@gmx.de designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 30 Mar 2008 07:43:48 +0000 Received: (qmail invoked by alias); 30 Mar 2008 07:43:59 -0000 Received: from c-76-116-243-84.hsd1.pa.comcast.net (EHLO c-76-116-243-84.hsd1.pa.comcast.net) [76.116.243.84] by mail.gmx.net (mp046) with SMTP; 30 Mar 2008 09:43:59 +0200 X-Authenticated: #3483660 X-Provags-ID: V01U2FsdGVkX1/v4swo6gbvSk30w0J4RvC35FeZP3hjrKIBT/tYK5 YYjP7/jADFp3fx Message-ID: <47EF44BD.20907@gmx.de> Date: Sun, 30 Mar 2008 03:43:57 -0400 From: Joerg Heinicke User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.12) Gecko/20080201 SeaMonkey/1.1.8 MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: Javaflow - major memory issue References: <966697.91329.qm@web57908.mail.re3.yahoo.com> <47EB230C.9090805@gmx.de> <927C343A-D85A-49F3-9D23-684F7B206E86@apache.org> <47EB9079.6010702@gmx.de> <6D111B22-8FF9-4B48-A1D5-D984CBC55BD8@apache.org> <47EC6631.6030302@gmx.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Checked: Checked by ClamAV on apache.org On 28.03.2008 04:55, Torsten Curdt wrote: >> The output I showed pointed to >> org.apache.cocoon.components.flow.java.Continuation which only seems >> to exist in Cocoon 2.1. Nothing unsets the context there. > > Hah - well spotted! > >> Having a look into the code continuations are only handled by >> JavaInterpreter. There are two methods callFunction(..) and >> handleContinuation(..) calling Continuation.registerThread() and >> deregisterThread() in a finally block. From a brief look I have no >> idea if I can just unset the ContinuationContext there as well. You >> might know more about it. > > We should add a try/finally block in Continuation.suspend() that clears > the context after a suspend. That should fix it. Unfortunately, it is not possible to unset the ContinuationContext completely. It's needed in JavaInterpreter.handleContinuation(..) when a child continuation is created: Continuation parentContinuation = (Continuation) parentwk.getContinuation(); ContinuationContext parentContext = (ContinuationContext) parentContinuation.getContext(); ContinuationContext context = new ContinuationContext(); context.setObject(parentContext.getObject()); context.setMethod(parentContext.getMethod()); Without completely rewriting it the only thing I did was to remove the data in the ContinuationContext that is not necessary. I do this by an extra call to ContinuationContext.onSuspend() in AbstractContinuable since Continuation is not aware of the implementation of its context (it's just an Object). Please review my changes [1] because I'm not really sure about them. They work for the normal case, but what happens in an error case? I can't see what's really going on except that the method is left on Continuation.suspend() ... It was very interesting to debug it when AbstractContinuable.sendPageAndWait(..) was actually hit twice. I guess this handling is different in 2.2. There a clean ContinuationContext is created on both callFunction(..) and handleContinuation(..). Joerg [1] http://svn.apache.org/viewvc?rev=642694&view=rev