Return-Path: Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 8506 invoked from network); 15 Feb 2003 21:08:30 -0000 Received: from mail.gmx.net (213.165.65.60) by daedalus.apache.org with SMTP; 15 Feb 2003 21:08:30 -0000 Received: (qmail 17741 invoked by uid 0); 15 Feb 2003 21:08:32 -0000 Received: from adsl-62-167-181-253.adslplus.ch (HELO gmx.ch) (62.167.181.253) by mail.gmx.net (mp008-rz3) with SMTP; 15 Feb 2003 21:08:32 -0000 Message-ID: <3E4EAC50.2000103@gmx.ch> Date: Sat, 15 Feb 2003 22:08:32 +0100 From: Jakob Braeuchi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: OJB Developers List Subject: Re: [CVS OJB tests fail] broker leak in cache References: <003d01c2d407$94dfcdf0$6479fea9@win> <3E4D1699.3090906@gmx.ch> <006a01c2d445$e88557c0$6479fea9@win> <3E4D2144.3030807@gmx.ch> <007a01c2d44d$8d1bb9d0$6479fea9@win> <3E4D28FB.500@gmx.ch> <009401c2d451$4985cc20$6479fea9@win> <3E4E0D62.4090101@gmx.ch> <000d01c2d4da$b5207f00$6479fea9@win> In-Reply-To: <000d01c2d4da$b5207f00$6479fea9@win> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N guten abend armin, i did some tests to monitor the pb-pool and added the method getNumActive() to PersistenceBrokerFactoryIF. the question is where to do the monitoring ? first try is to do it in tearDown of each testcase so we can immediatly see where the leakage comes from. public void tearDown() { PersistenceBrokerFactoryIF factory = PersistenceBrokerFactoryFactory.instance(); int activeBrokers = 0; try { Article a = createArticle(testId); deleteArticle(a); broker.clearCache(); broker.close(); activeBrokers = factory.getNumActive(); assertEquals("All Brokers should be closed", 0, activeBrokers); } catch (AssertionFailedError t) { factory.releaseAllInstances(); throw t; } } there are two problems to be solved: 1) every tearDown() has to be modified 2) i cannot clear the pool on assertion failures, so all subsequent testcases will fail ! any ideas ? jakob Armin Waibel wrote: >Morgen Jakob, > >----- Original Message ----- >From: "Jakob Braeuchi" >To: "OJB Developers List" >Sent: Saturday, February 15, 2003 10:50 AM >Subject: Re: [CVS OJB tests fail] broker leak in cache > > > > >>hi armin, >> >>is there a testcase to detect cache leakage ? >> >> > >No, but thats a great idea! Only thing we have to do >is to monitor the PB-pool. Another possibility could be >tracking of abandoned PB in the same way as in jakarta-DBCP >is done. > >regards, >Armin > > > >>jakob >> >>Armin Waibel wrote: >> >> >> >>>----- Original Message ----- >>>From: "Jakob Braeuchi" >>>To: "OJB Developers List" >>>Sent: Friday, February 14, 2003 6:35 PM >>>Subject: Re: [CVS OJB tests fail] broker leak in cache >>> >>> >>> >>> >>> >>> >>>>hi armin, >>>> >>>>but why didn't this happen when using Identity(Object obj) which is >>>> >>>> >>>> >>>> >>>also >>> >>> >>> >>> >>>>using the default broker behind the scenes ?? >>>>could you please explain the details to me ? >>>> >>>> >>>> >>>> >>>in your implementation you forgot to call PB.close() after using >>>the broker, in the Identity constructor this was done. >>> >>>And I declared the Identity(Object ojb) constructor deprecated, >>>because when multiple databases were used the Identity was >>>only unique when the Identity instance knows to which database >>>the objects belongs (reason: we generate the PK values of the >>> >>> >object). > > >>>HTH >>>regards, >>>Armin >>> >>> >>> >>> >>> >>>>jakob >>>> >>>> >>>>Armin Waibel wrote: >>>> >>>> >>>> >>>> >>>> >>>>>----- Original Message ----- >>>>>From: "Jakob Braeuchi" >>>>>To: "OJB Developers List" >>>>>Sent: Friday, February 14, 2003 6:03 PM >>>>>Subject: Re: [CVS OJB tests fail] broker leak in cache >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>hi armin, >>>>>> >>>>>>i do not understand why it worked before. >>>>>>new Identity(Object obj) also uses the default broker. >>>>>> >>>>>> public Identity(Object objectToIdentitify) >>>>>> { >>>>>> PersistenceBroker broker = null; >>>>>> try >>>>>> { >>>>>> broker = >>>>>>PersistenceBrokerFactory.defaultPersistenceBroker(); <<<< >>>>>> init(objectToIdentitify, broker, null); >>>>>>... >>>>>> >>>>>>where's the difference ? can you please explain this to me... >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>your implementation cause a broker leak. The obtained PB instances >>>>>never be closed. >>>>> >>>>>regards, >>>>>Armin >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>jakob >>>>>> >>>>>>Armin Waibel wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>Hi Jakob, >>>>>>> >>>>>>>----- Original Message ----- >>>>>>>From: "Jakob Braeuchi" >>>>>>>To: "OJB Developers List" >>>>>>>Sent: Friday, February 14, 2003 5:17 PM >>>>>>>Subject: Re: [CVS OJB tests fail] broker leak in cache >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>hi armin, >>>>>>>> >>>>>>>>did it work _before_ my changes ? if yes i could undo them. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>yes it worked without your changes. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>a) remove the public void cache(Object obj) >>>>>>>>i agree. this method is imo never used in ojb. >>>>>>>> >>>>>>>>b) change method remove(Object obj) >>>>>>>>i think this should be ok >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>ok, I'm started to make these changes >>>>>>>in the cache package. >>>>>>> >>>>>>>regards, >>>>>>>Armin >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>jakob >>>>>>>> >>>>>>>> >>>>>>>>Armin Waibel wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>>Hi all, >>>>>>>>> >>>>>>>>>in CVS ObjectCacheDefaultImpl we had >>>>>>>>>a PB leak. >>>>>>>>>This is caused by using PBF.defaultPB calls >>>>>>>>>without closing the broker. Jakob add this to avoid >>>>>>>>>using of deprecated Identity constructor. >>>>>>>>>But the real problem is that this solution never >>>>>>>>>will work, because of using the default broker. >>>>>>>>> >>>>>>>>>Thus I propose the following changes in ObjectCache: >>>>>>>>>a) remove the >>>>>>>>>public void cache(Object obj) throws >>>>>>>>>ClassNotPersistenceCapableException; >>>>>>>>>method, this will never work. >>>>>>>>> >>>>>>>>>b) change method >>>>>>>>>public void remove(Object obj); >>>>>>>>>to >>>>>>>>>public void remove(Identity oid); >>>>>>>>> >>>>>>>>>What do you think? >>>>>>>>> >>>>>>>>> >>>>>>>>>regards, >>>>>>>>>Armin >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>------------------------------------------------------------------- >>>>>> >>>>>> >- > > >>>>>>> >>>>>>> >>>- >>> >>> >>> >>> >>>>>>>> >>>>>>>> >>>>>>>>>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >>>>>>>>>For additional commands, e-mail: ojb-dev-help@db.apache.org >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>-------------------------------------------------------------------- >>>>> >>>>> >- > > >>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>>>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >>>>>>>>For additional commands, e-mail: ojb-dev-help@db.apache.org >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>-------------------------------------------------------------------- >>>>> >>>>> >- > > >>>>>> >>>>>> >>>>>>>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >>>>>>>For additional commands, e-mail: ojb-dev-help@db.apache.org >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>--------------------------------------------------------------------- >>>> >>>> >>>>> >>>>> >>>>>>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >>>>>>For additional commands, e-mail: ojb-dev-help@db.apache.org >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>--------------------------------------------------------------------- >>>> >>>> >>>>>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >>>>>For additional commands, e-mail: ojb-dev-help@db.apache.org >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>--------------------------------------------------------------------- >>> >>> >>>>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >>>>For additional commands, e-mail: ojb-dev-help@db.apache.org >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>--------------------------------------------------------------------- >>>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >>>For additional commands, e-mail: ojb-dev-help@db.apache.org >>> >>> >>> >>> >>> >>> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >>For additional commands, e-mail: ojb-dev-help@db.apache.org >> >> >> >> >> > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >For additional commands, e-mail: ojb-dev-help@db.apache.org > > > >