Re: Very Dangerous bug in XA connection pooling and SL EJBs with jboss-4.2.3 & latest postgresql-8.4-701.jdbc3.jar

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org, jboss-user(at)lists(dot)jboss(dot)org
Subject: Re: Very Dangerous bug in XA connection pooling and SL EJBs with jboss-4.2.3 & latest postgresql-8.4-701.jdbc3.jar
Date: 2010-03-03 10:30:37
Message-ID: 4B8E3A4D.9000809@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-jdbc

Achilleas Mantzios wrote:
> Στις Wednesday 03 March 2010 10:54:53 ο/η Heikki Linnakangas έγραψε:
>> Achilleas Mantzios wrote:
>>> i'll try to make a test case, but i think now there is enuf material for anyone to make his own case,
>>> please ask whatever i may have missed, and thank you for your attention.
>> If you can set logLevel to DEBUG (ie. loglevel=2 in connection string),
>> run the code, and send over the logs, that would help a lot. From that
>> we should see what exactly is the sequence of XA commands the JDBC
>> driver is receiving from JBoss.
>
> As loglevel configuration property to org.postgresql.ds.common.BaseDataSource is not supported in the lastest driver,
> i made this patch (i attach it) against postgresql-jdbc-8.4-701.src, also i set in jboss
>
> <datasources>
> <xa-datasource>
> <jndi-name>pgsql</jndi-name>
> <use-java-context>true</use-java-context>
> <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
> <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
> <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
> <xa-datasource-property name="DatabaseName">dynacom</xa-datasource-property>
> <xa-datasource-property name="User">postgres</xa-datasource-property>
> <xa-datasource-property name="Password">xxxx</xa-datasource-property>
> <xa-datasource-property name="Compatible">8.2</xa-datasource-property>
> <xa-datasource-property name="Loglevel">2</xa-datasource-property>
> <track-connection-by-tx/>
> <min-pool-size>1</min-pool-size>
> <max-pool-size>2</max-pool-size>
> <metadata>
> <type-mapping>PostgreSQL 8.0</type-mapping>
> </metadata>
> </xa-datasource>
> </datasources>
>
> But i dont see anything spectacular comming out of PostgreSQL logs.
> in postgresql.conf I have set
> client_min_messages = debug5
> log_min_messages = debug5

The extra logs should go somewhere in the client side, in one of the
jboss log files. If you can't find it, you can do something like this in
the application to redirect it to a file:

java.io.Writer output = new
java.io.FileWriter("/tmp/postgresql-jdbc.debug.txt", true);
java.sql.DriverManager.setLogWriter(new
java.io.PrintWriter(output,true));

> however playing with <xa-datasource-property name="Loglevel"></xa-datasource-property> does not seem to change a thing.
> Am i missing something?

Not sure why that's not working, but here's one way of setting loglevel:

1. Create file "org/postgresql/driverconfig.properties" with line
"loglevel=2" in it:
echo "loglevel=2" > org/postgresql/driverconfig.properties
2. Add file to the driver jar:
jar uvf postgresql.jar org/postgresql/driverconfig.properties

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Achilleas Mantzios 2010-03-03 10:57:31 Re: Very Dangerous bug in XA connection pooling and SL EJBs with jboss-4.2.3 & latest postgresql-8.4-701.jdbc3.jar
Previous Message Achilleas Mantzios 2010-03-03 10:09:40 Re: Very Dangerous bug in XA connection pooling and SL EJBs with jboss-4.2.3 & latest postgresql-8.4-701.jdbc3.jar

Browse pgsql-jdbc by date

  From Date Subject
Next Message Achilleas Mantzios 2010-03-03 10:57:31 Re: Very Dangerous bug in XA connection pooling and SL EJBs with jboss-4.2.3 & latest postgresql-8.4-701.jdbc3.jar
Previous Message Achilleas Mantzios 2010-03-03 10:09:40 Re: Very Dangerous bug in XA connection pooling and SL EJBs with jboss-4.2.3 & latest postgresql-8.4-701.jdbc3.jar