Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id C616D1EA2927 for ; Sat, 9 Jun 2012 05:09:37 -0300 (ADT) Received: from smtp.dc.baikal.ru ([87.103.128.133]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SdGjl-0006Sx-V9 for pgsql-jdbc@postgresql.org; Sat, 09 Jun 2012 08:09:36 +0000 Received: from [10.0.4.75] (it319k5.dc-local [10.0.4.75]) (authenticated bits=0) by smtp.dc.baikal.ru (8.13.8/8.13.8) with ESMTP id q5989Iic009224; Sat, 9 Jun 2012 17:09:18 +0900 Message-ID: <4FD304AF.30707@dc.baikal.ru> Date: Sat, 09 Jun 2012 17:09:19 +0900 From: Vlad Arkhipov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Craig Ringer CC: pgsql-jdbc@postgresql.org Subject: Re: Connection.isValid(int timeout) implementation References: <4FD1E2BE.8020800@dc.baikal.ru> <4FD20186.8050807@ringerc.id.au> <4FD2B4E5.6000404@dc.baikal.ru> <4FD2EAEA.3010807@ringerc.id.au> In-Reply-To: <4FD2EAEA.3010807@ringerc.id.au> Content-Type: multipart/alternative; boundary="------------030205040808090003090404" X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/38 X-Sequence-Number: 23032 This is a multi-part message in MIME format. --------------030205040808090003090404 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 06/09/2012 03:19 PM, Craig Ringer wrote: > On 06/09/2012 10:28 AM, Vlad Arkhipov wrote: >> However there are some projects that strongly rely on this method to >> test the connection (for example Arjuna Transaction Manager that is >> used by JBoss Application Server). Are there any plans of >> implementing this feature? >>> Really? JBoss AS 7.1.1.Final is quite happy with PgJDBC >>> (postgresql-9.1-901-1.jdbc4.jar) here. What's your configuration? >>> Your -ds.xml or jboss-cli "create datasource" command? >> They have a memory leak in JTS 4.16.4 (JBoss AS 7.1.1), so if you use >> XA datasource and the driver does not implement Connection.isValid, >> Transaction Manager will create and store in memory a new XA >> connection every 2 minutes. > > Good to know. Please post the reference to the JBoss JIRA ticket - > assuming, as it sounds like, you're referring to an acknowledged bug. > > It sounds like it'll be important to make sure that isValid() makes it > into the 9.2 JDBC driver release. https://issues.jboss.org/browse/JBTM-1183 > Re your -ds.xml, does setting an explicit connection validator help? > > > class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"> > class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"> > > > > Otherwise I think it'll use > org.jboss.jca.adapters.jdbc.extensions.novendor.JDBC4ValidConnectionChecker, > which I expect won't work without isValid(). Yes, I have these lines in the datasource description. However the recovery subsystem does not use them. I debugged a bit more and found out that it's also necessary to specify the recovery plugin. --------------030205040808090003090404 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 06/09/2012 03:19 PM, Craig Ringer wrote:
On 06/09/2012 10:28 AM, Vlad Arkhipov wrote:
However there are some projects that strongly rely on this method to test the connection (for example Arjuna Transaction Manager that is used by JBoss Application Server). Are there any plans of implementing this feature?
Really? JBoss AS 7.1.1.Final is quite happy with PgJDBC (postgresql-9.1-901-1.jdbc4.jar) here. What's your configuration? Your -ds.xml or jboss-cli "create datasource" command?
They have a memory leak in JTS 4.16.4 (JBoss AS 7.1.1), so if you use XA datasource and the driver does not implement Connection.isValid, Transaction Manager will create and store in memory a new XA connection every 2 minutes.

Good to know. Please post the reference to the JBoss JIRA ticket - assuming, as it sounds like, you're referring to an acknowledged bug.

It sounds like it'll be important to make sure that isValid() makes it into the 9.2 JDBC driver release.
https://issues.jboss.org/browse/JBTM-1183
Re your -ds.xml, does setting an explicit connection validator help?

<validation>     
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"></valid-connection-checker>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"></exception-sorter>
</validation>


Otherwise I think it'll use org.jboss.jca.adapters.jdbc.extensions.novendor.JDBC4ValidConnectionChecker, which I expect won't work without isValid().
Yes, I have these lines in the datasource description. However the recovery subsystem does not use them.
I debugged a bit more and found out that it's also necessary to specify the recovery plugin.

<recovery no-recovery="false">
  <recovery-plugin class-name="org.jboss.jca.core.recovery.ValidatingManagedConnectionFactoryRecoveryPlugin" />
</recovery>

--------------030205040808090003090404--