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 PGXAConnection.java 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?
pgsql-jdbc by date
|Next:||From: Craig Ringer||Date: 2013-02-12 07:36:23|
|Subject: Re: [JDBC] JPA + enum == Exception|
|Previous:||From: Guillaume Cottenceau||Date: 2013-02-11 08:37:32|
|Subject: Re: RE: [JDBC] é converted in Ã©|