Skip site navigation (1) Skip section navigation (2)

PostgreSQL XAResource & GlassFish

From: Bryan Varner <bvarner(at)polarislabs(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: PostgreSQL XAResource & GlassFish
Date: 2013-02-12 03:36:30
Message-ID: A2B35D2698B0C74F9B8333525E67ED0135F89007@plindyexch02.polarislabs.lan (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Greetings all,

I'm having a nightmare of a time using the PGXADataSource in a production GlassFish environment. It worked fine our lower volume test environments.

Is anyone else using the XADataSource with GlassFish? How about other JEE containers?

The problems we're having seem to be specific to the XA implementation, or possibly the GlassFish connection pool.

Things I've tracked down so far:

  * Race conditions as multiple threads are participating in the same transaction, invoking XAResource methods. Status checks in are throwing exceptions (if state == ACTIVE) throw) by the time in invokes the throw, the state is != ACTIVE)  Before you start telling me I shouldn't be using threads in a  JEE environment let me remind you that EJBs by default are served out of thread pools, and allow for concurrent threads to participate within a single TX scope. This is outlined as part of the transaction context in the JTS spec (section 2.2 and 2.3) and synchronized thread-safe access to XAResources is described (without being explicitly called out) by the JTA 1.0.1 spec.

 * It appears that a second thread attempting to join an existing XAResource's scope with start(XID, TMJOIN) is going to be refused, even if it's attempting to participate in the same XID. The exception thrown is one complaining about interleaving, even though it's the -same- XID, not a sub-set of work in another TX.

It seems as though the PG XAResource implementation is a single-association implementation that will only work properly in a single-threaded environment. GlassFish appears to be expecting it to work as a multiple association (but without TX interleaving) resource. Am I missing some sort of magical configuration setting, or is this a known limitation (the whole single-threaded, non synchronized, and single-association) of the current driver?

-Bryan Varner


pgsql-jdbc by date

Next:From: Craig RingerDate: 2013-02-12 07:36:23
Subject: Re: [JDBC] JPA + enum == Exception
Previous:From: Guillaume CottenceauDate: 2013-02-11 08:37:32
Subject: Re: RE: [JDBC] é converted in é

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group