Return-Path: Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 58126 invoked by uid 99); 28 Dec 2004 17:08:30 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of clinton.begin@gmail.com designates 64.233.184.192 as permitted sender) Received: from wproxy.gmail.com (HELO wproxy.gmail.com) (64.233.184.192) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 28 Dec 2004 09:08:27 -0800 Received: by wproxy.gmail.com with SMTP id 71so436383wri for ; Tue, 28 Dec 2004 09:08:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=KITQ6A6vFyz1CyThx3GKD9hdvsoez2a3x5/JPmJaXABmBUpGIMexD8TWZ0jlyxrpqoqYR5/W0gKiXn2f6fu0wwzj7ll4ce3ZhFUlAAiHK0PM1kxJ+uriyl/JDdtE2DoelLbk+tGXhkiKB1cf1q7nLCNFjSDqp1dEOfdO4pMDvUQ= Received: by 10.54.41.55 with SMTP id o55mr6851wro; Tue, 28 Dec 2004 09:08:25 -0800 (PST) Received: by 10.54.33.38 with HTTP; Tue, 28 Dec 2004 09:08:25 -0800 (PST) Message-ID: <16178eb10412280908342932f9@mail.gmail.com> Date: Tue, 28 Dec 2004 10:08:25 -0700 From: Clinton Begin Reply-To: cbegin@ibatis.com To: ibatis-user-java@incubator.apache.org Subject: Re: session leak in ibatis 2.0.8 In-Reply-To: <41D18751.2000704@inaphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41D165D7.1010701@inaphone.com> <16178eb10412280754188df985@mail.gmail.com> <41D18751.2000704@inaphone.com> X-Virus-Checked: Checked Baldur, I just ran through the unit tests which use an update, just as you've described above. I cannot recreate the problem. I even stepped through with a debugger and watched the resource close. The end state after my update was a session pool size of 0. endTransaction() is automatically called in SqlMapExecutorDelegate (see autoEndTransaction()). That logic has not changed since the initial 2.0 release, which makes me wonder how such a serious problem wouldn't have been discovered by thousands of users in nearly 9 months. I'm not sure what is different about your environment. Could you put together a simple unit test to demonstrate the problem? Clinton On Tue, 28 Dec 2004 17:18:25 +0100, Baldur Norddahl wrote: > Clinton Begin wrote: > > endTransaction after every query. YES! It is by design that you have to > GUARANTEE to call endTransaction() if startTransaction() is called. So make > sure to call it in a finally block. Here's the example from the docs > (again): > startTransaction() was never called. You have to call endTransaction() > anyway because ibatis forgets to close the session and return the db > connection to the pool. > > > try { sqlMap.startTransaction (); // .... do work sqlMap.commitTransaction > (); } finally { sqlMap.endTransaction (); } Or, if you just call one of the > work methods (queryForX, insert, update, delete etc.), then iBATIS does this > for you (i.e. you don't call startTransaction()). > No, that is what I am trying to say. iBatis does NOT call endTransaction() > when you work without startTransaction(). It only commits your work, but > forgets to release the resource. > > Baldur >