Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A3D6D17C4F for ; Wed, 3 Jun 2015 12:18:32 +0000 (UTC) Received: (qmail 29492 invoked by uid 500); 3 Jun 2015 12:18:28 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 29426 invoked by uid 500); 3 Jun 2015 12:18:27 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 29415 invoked by uid 99); 3 Jun 2015 12:18:27 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jun 2015 12:18:27 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 6E65118275D for ; Wed, 3 Jun 2015 12:18:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.879 X-Spam-Level: ** X-Spam-Status: No, score=2.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id BZ1XzTSkBYhZ for ; Wed, 3 Jun 2015 12:18:24 +0000 (UTC) Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 38E6827606 for ; Wed, 3 Jun 2015 12:18:24 +0000 (UTC) Received: by wibdt2 with SMTP id dt2so10461999wib.1 for ; Wed, 03 Jun 2015 05:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=y554o/CWTriAzrSFMU574uHmKGBxuTqYJ1j8zq25RNY=; b=JGrSJ/kDCaLV2g4rUar3sYVTiOBDYBIGcyFc5BsF69cL83sUrL5HhitI619GhLdcfY hk44Xn1dIyWfzOawrGtfbxIyZ+j4OcTzTIzRdez6KuLaIrdN5TZYb0z0S0WdiToax/hk +i5qGXm94YSiWNoDerG9uN9IijK2oT3wj00QqgeJqctTSAlwLDgCfPviX6b4/dHiVBVJ LkXTROgh9awrGK3Xz16rYBfFn/e1w8OBoyBPQ+MJFqxw4CQv3M6SV3/jLnq5h1u9V84k PfFSTfrC6k+DuP6Wb1MY255FYZ6HALGjhRaeB3uFrNyv8RvfFR6TcJ1HyIlODu7PUp9M knNQ== MIME-Version: 1.0 X-Received: by 10.180.87.199 with SMTP id ba7mr42036219wib.81.1433333902858; Wed, 03 Jun 2015 05:18:22 -0700 (PDT) Received: by 10.28.194.212 with HTTP; Wed, 3 Jun 2015 05:18:22 -0700 (PDT) In-Reply-To: <556EC74A.5040306@apache.org> References: <556DB6D3.4080602@apache.org> <556EC74A.5040306@apache.org> Date: Wed, 3 Jun 2015 15:18:22 +0300 Message-ID: Subject: Re: Tomcat DBCP 8.0.18 issue From: =?UTF-8?B?0JDQvdGC0L7QvSDQnNCw0YbRjtC6?= To: Tomcat Users List Content-Type: multipart/alternative; boundary=f46d0444e9391fdf7305179c0e32 --f46d0444e9391fdf7305179c0e32 Content-Type: text/plain; charset=UTF-8 Mark, big thanks for a quick historical review, it was very intreresting! I was thinking that tomcat-jdbc is something new, but wasn't sure about project maintenance. 2015-06-03 12:22 GMT+03:00 Mark Thomas : > On 03/06/2015 07:24, Tweak Ronaldo wrote: > > Thanks Mark, yes I have mixed together Tomcat JDBC 8 and DBCP 7, my bad. > > Although I don't understand why Tomcat JDBC don't use DBCP as default > > solution for connections pooling. > > Tomcat does - and always has - used Commons DBCP for connection pooling > by default. > > We do package rename Commons DBCP to avoid conflicts for web > applications that package it in WEB-INF/lib and we have changed how we > have done that repackaging over the years but the source code remains > unchanged from which ever release version / tag / svn revision we select > to pull in. > > > What follows is a short(ish) history of Commons DBCP and tomcat-jdbc > which attempts to explain why Tomcat ended up shipping two connection > pools. > > Commons DBCP 1 has very poor performance in highly concurrent > environments. Things improved during the 1.x series but really didn't > improve much above 'awful'. > > As users started to run Tomcat on machines with increasing numbers of > cores, the performance issues with DBCP 1 started to have a noticeable > impact for some web applications. Something needed to be done to address > the performance issues in concurrent environments. > > There were two options: > a) fix DBCP (essentially this meant a major re-write for Commons Pool) > b) implement a new connection pool > > My preference was for a) although I had little time to do any work along > those lines. Keep in mind that my preference for a) is likely to have > coloured my view of the history of this. > > Filip's preference was for b). He also felt that there was room to > further improve performance by removing the overhead inherent in: > i) Commons DBCP being built on Commons Pool > (a single module could be more tightly / efficiently integrated) > ii) Commons DBCP aiming to fully follow the JDBC specs > (making some of the behaviours optional reduced overhead for > users that didn't want/need them) > > Filip therefore wrote tomcat-jdbc. He tried to release it several times > without success. Apache releases need 3 +1 votes and there simply wasn't > the interest in this component from the other Tomcat developers (this > was one of my concerns with this approach). > > In order to get it released, tomcat-jdbc was bundled with Tomcat from > 7.0.19 onwards (July 2011) but it was never configured to be the default. > > Filip's focus at work moved away from Tomcat development in 2012. He > does pop back from time to time (mainly to fix issues with tomcat-jdbc) > but it is fair to say that - at the moment - issues in tomcat-jdbc are > not being resolved in a timely manner. > > Around the same time tomcat-jdbc was bundled with Tomcat, I (and others > from Commons) started on Commons Pool 2 and Commons DBCP 2. Pool 2 was > finally released in 2013 and DBCP 2 in 2014 (Tomcat 8 always used DBCP 2 > and had been depending on snapshot versions for some time before that). > > Commons Pool 2 and Commons DBCP 2 continue to be maintained by the > Commons community (there was a Pool 2.4.1 release just last week) and I > aim to keep Tomcat's copy of DBCP 2 (and Pool 2) up to date. > > Generally, bugs reported against Commons DBCP2 and Commons Pool 2 are > addressed in a timely manner. > > tomcat-jdbc provided (and continues to provide) a simple solution for > those Tomcat 6 and Tomcat 7 users that needed better performance under > concurrent loads. Tomcat 8 and onwards users have DBCP 2 so there is > less need for tomcat-jdbc for those users. > > Hope this helps explain how we got to where we are. > > As I typed this, I started to wonder if we should even ship tomcat-jdbc > with Tomcat 9. I'll start a discussion along those lines on the dev list. > > mark > > > > > 2015-06-02 16:59 GMT+03:00 Mark Thomas : > > > >> On 01/06/2015 14:22, Tweak Ronaldo wrote: > >>> Hello guys, > >> > >> Assuming you don't want to limit your question to men only, you would be > >> better to use of of the following greetings: > >> Hello, > >> Hello all, > >> Hello folks, > >> > >> etc. > >> > >>> we have migrated to Tomcat DBCP 8.0.18 from 7.0.37 recently and > >>> faced the following issue: > >>> after database restart (Postgres), our application wasn't been able to > >>> restore connectivity to DB, all connections were closed and every time, > >>> after failed attempt to execute some SQL statement, returned back to > >> pool. > >>> Pool is configured with all tests (on borrow, on return, on connect, > >> while > >>> idle) disabled. Pool configuration is the same for 8.0.18 and 7.0.37. > >>> While using 7.0.37 DBCP is able to restore from DB restart, because > >>> PoolableConnection class performs explicit check if underlying SQL > >>> connection is closed: > >>> > >>> public synchronized void close() throws SQLException { > >>> if (_closed) { > >>> // already closed > >>> return; > >>> } > >>> > >>> boolean isUnderlyingConectionClosed; > >>> try { > >>> isUnderlyingConectionClosed = _conn.isClosed(); > >>> } catch (SQLException e) { > >>> try { > >>> _pool.invalidateObject(this); // XXX should be guarded > to > >>> happen at most once > >>> } catch(IllegalStateException ise) { > >>> // pool is closed, so close the connection > >>> passivate(); > >>> getInnermostDelegate().close(); > >>> } catch (Exception ie) { > >>> // DO NOTHING the original exception will be rethrown > >>> } > >>> throw (SQLException) new SQLException("Cannot close > >> connection > >>> (isClosed check failed)").initCause(e); > >>> } > >>> ... > >>> > >>> My question is: why this check was removed and how can one get the same > >>> behaviour (of 7.0.37) using 8.0.18 (not using on borrow, on return, > while > >>> idle validations, which are SQL queries)? I see that there is a > property > >> in > >>> pool configuration which allows user to provide custom Validator, > though > >> I > >>> don't want to go this way because DBCP configuration is performed by > 3rd > >>> party library and we don't have direct access to it. > >> > >> The check to which you refer was not removed. It is still present in the > >> code base and - as far as I can tell from a quick look at svn - never > >> been removed. > >> > >> DBCP has no support for a custom validator. You appear to have confused > >> something else with Tomcat's port of Commons DBCP (the Tomcat JDBC pool > >> perhaps?). > >> > >> Mark > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > >> For additional commands, e-mail: users-help@tomcat.apache.org > >> > >> > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > --f46d0444e9391fdf7305179c0e32--