Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C80599FD6 for ; Wed, 22 Feb 2012 10:35:05 +0000 (UTC) Received: (qmail 51988 invoked by uid 500); 22 Feb 2012 10:35:05 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 51951 invoked by uid 500); 22 Feb 2012 10:35:05 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 51939 invoked by uid 99); 22 Feb 2012 10:35:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2012 10:35:05 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=FSL_RCVD_USER,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [60.234.4.75] (HELO nctlincom02.orcon.net.nz) (60.234.4.75) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2012 10:34:58 +0000 Received: from mx9.orcon.net.nz (mx9.orcon.net.nz [219.88.242.59]) by nctlincom02.orcon.net.nz (8.14.3/8.14.3/Debian-9.4) with ESMTP id q1MAYklJ026993 for ; Wed, 22 Feb 2012 23:34:46 +1300 Received: from Debian-exim by mx9.orcon.net.nz with local (Exim 4.69) (envelope-from ) id 1S09Ws-000351-0N for user@cayenne.apache.org; Wed, 22 Feb 2012 23:34:34 +1300 Received: from [121.98.190.242] (helo=matai.local) by mx9.orcon.net.nz with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1S09Wr-00034g-M1 for user@cayenne.apache.org; Wed, 22 Feb 2012 23:34:33 +1300 Message-ID: <4F44C4B9.20308@lindesay.co.nz> Date: Wed, 22 Feb 2012 23:34:33 +1300 From: Andrew Lindesay User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: user@cayenne.apache.org Subject: Re: Question on ObjectContext and Deserialization References: <4F3A37C9.2080708@lindesay.co.nz> <199079C1-27EA-4F09-A9B2-736A45DBF5D4@objectstyle.org> <4F3E299E.8040807@lindesay.co.nz> <7C266DED-920A-4D14-BE77-ACD29C4907D0@objectstyle.org> <4F3ED9C8.2070906@lindesay.co.nz> In-Reply-To: <4F3ED9C8.2070906@lindesay.co.nz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DSPAM-Check: by mx9.orcon.net.nz on Wed, 22 Feb 2012 23:34:33 +1300 X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Wed Feb 22 23:34:34 2012 X-DSPAM-Confidence: 0.9935 X-DSPAM-Probability: 0.0000 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN, default) X-Spam-Score: 0.00 () [Hold at 5.00] X-CanIt-Geo: ip=121.98.190.242; country=NZ; region=E7; city=Auckland; latitude=-36.8667; longitude=174.7667; http://maps.google.com/maps?q=-36.8667,174.7667&z=6 X-CanItPRO-Stream: base:default X-Canit-Stats-ID: 05GAWyKT0 - 559c9d878119 - 20120222 X-Scanned-By: CanIt (www . roaringpenguin . com) on 172.16.100.175 Hi there; It does appear that the problem is in an Apache Commons abstract superclass. What is happening is that whilst running; AbstractReferenceMap.doReadObject(..) ...the method... AbstractReferenceMap.checkCapacity(..) ...is invoked and it seems to be doubling the size of the Map's entry array on de-serialization. Through sequential serialization + de-serialization this yields the exponential growth in the memory consumption. It seems that the problem is caused by the 'threshold' value being calculated after to populating the Map during de-serialization. I have re-built 3.0-STABLE with commons 3.2.1 and it still seems to exhibit the same problem. The release cycles for commons seems to be quite long these days. Hmmm..... Regards; On 18/02/12 11:50 AM, Andrew Lindesay wrote: > Hi Andrus; > > It does seem rather strange. > > I'm starting the application with maven (from Eclipse) and > jetty-maven-plugin. No hot redeploy. No actual container per se. The > class-loader should be the same so shouldn't be re-creating "isolated > singletons or statics". I'm using a Filter to serialize-->deserialize > the attributes on the HttpSession in order to test how some > infrastructure handles serialization-->deserialization of the session > attributes. > > If I explicitly don't serialize-->deserialize the ObjectContext then > there is no problem; so serializing ObjectContext as the root object > does seem to cause the problem. > > The incremental increase in the memory consumption seems to be roughly > exponential in relation to the number of deserializations of the > ObjectContext. That may be a clue; I may download Apache commons and see > if I can see anything obvious there in the LRU map. Like you say though; > it probably shouldn't be serializing this stuff anyway though. > > It looks like "SQLTemplateResourceManager" is created via reflection so > it may be hard to profile for memory usage. > > I'll log a Jira when I get a moment. > > Regards; > > On 17/02/12 11:29 PM, Andrus Adamchik wrote: >> Interesting... I didn't realize we have a static Velocity runtime in >> the app. This must to be changed to instance variable with correct >> scope, (and if needed shut down properly when ServerRuntime is >> shutdown). Could you please log a Jira - we need to investigate. >> >> BTW, are you doing hot redeploy of your app? This in combination with >> static Velocity runtime might produce the observed behavior. >> >> Andrus >> >> >> On Feb 17, 2012, at 1:19 PM, Andrew Lindesay wrote: >> >>> Hi; >>> >>> It looks like it is holding onto lots (hundreds of megs) of; >>> >>> org.apache.commons.collections.map.AbstractHashedMap$HashEntry[] >>> > org.apache.commons.collecitons.map.LRUMap >>> >> org.apache.cayenne.access.jdbc.SQLTemplateResourceManager >>> >>> ...velocity >>> >>> Not quite understanding yet... as it seems like this wouldn't be >>> something stored on an object context. >>> >>> Regards; >>> >>> On 16/02/12 7:50 PM, Andrus Adamchik wrote: >>>>>> an OutOfMemory -- even with substantial quantities of memory >>>>>> available. >>>> >>>> This is a hint actually.. Maybe the problem is not heap size, but >>>> perm gen size instead? Try increasing that: >>>> >>>> -XX:MaxPermSize=256m >>>> >>>> On Feb 16, 2012, at 9:44 AM, Andrus Adamchik wrote: >>>> >>>>> This is strange indeed. Haven't seen such behavior. May need some >>>>> profiling on your end I guess. >>>>> >>>>> Andrus >>>>> >>>>> >>>>> On Feb 14, 2012, at 1:30 PM, Andrew Lindesay wrote: >>>>>> Hello; >>>>>> >>>>>> I have a little question on the ObjectContext in 3.0.2. >>>>>> >>>>>> I'm keeping an ObjectContext in an HttpSession instance's >>>>>> attributes for re-use between request-response cycles. When I >>>>>> serialize this ObjectContext instance, it (+ other objects) stores >>>>>> out to< 8k in my test case, but then deserializing the >>>>>> ObjectContext causes an OutOfMemory -- even with substantial >>>>>> quantities of memory available. >>>>>> >>>>>> Has anybody else seen this or is there anything to be weary of >>>>>> before I look into it further? >>>>>> >>>>>> Regards >>>>>> >>>>>> -- >>>>>> Andrew Lindesay >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >>> -- >>> Andrew Lindesay >>> www.silvereye.co.nz >>> >> >> > > -- Andrew Lindesay www.silvereye.co.nz