Error enlisting a ConnectionJavaProxy

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Error enlisting a ConnectionJavaProxy

Andrew Frolov
Hi guys!

Sometimes i've got an error in bitronix connection.
Like this one - http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
Or "transaction timed out"
Or something else.

After exception occured connection in connection pool remains broken and can't be used again. If I try to use this connection again I got an error

... Hibernate exception...
......
Caused by: java.sql.SQLException: error enlisting a ConnectionJavaProxy of a JdbcPooledConnection from datasource ItemDB_2_xa in state ACCESSIBLE with usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on Pooled connection wrapping physical connection org.postgresql.jdbc4.Jdbc4Connection@70f71024
        at bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
        at bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
        at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
        at bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
        at bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
        at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
        at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
        at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
        at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
        at org.hibernate.loader.Loader.doQuery(Loader.java:717)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
        at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
        ... 41 more
Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an XAResourceHolderState with uniqueName=ItemDB_2_xa XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a Bitronix XID [323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63], error=XAER_RMERR
        at bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
        at bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
        at bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
        ... 55 more
Caused by: org.postgresql.xa.PGXAException: Transaction interleaving not implemented
        at org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
        at bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
        at bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
        at bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
        ... 57 more


What am I doing wrong? What shoud I do to clear the connection properly?

My code to run transactions:

    UserTransaction transaction = TransactionManagerServices.getTransactionManager();
    setTimeout(transaction);
    transaction.begin();
    boolean rollback = false;
    try {
      callback.execute();
    } catch (Throwable e) {
      rollback = true;
      throw e;
    } finally {
      if (rollback)
        transaction.rollback();
      else
        transaction.commit();
    }

jta.properties

bitronix.tm.serverId=local_shard
bitronix.tm.2pc.async=false
bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
bitronix.tm.2pc.debugZeroResourceTransactions = false
bitronix.tm.disableJmx=true
bitronix.tm.synchronousJmxRegistration = true
bitronix.tm.currentNodeOnlyRecovery=true
bitronix.tm.allowMultipleLrc = false

bitronix.tm.journal = disk
bitronix.tm.journal.disk.forcedWriteEnabled = true
bitronix.tm.journal.disk.forceBatchingEnabled = true
bitronix.tm.journal.disk.skipCorruptedLogs = false
bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
bitronix.tm.journal.disk.maxLogSize = 1
bitronix.tm.journal.disk.filterLogStatus = true

bitronix.tm.timer.defaultTransactionTimeout = 60
bitronix.tm.timer.gracefulShutdownInterval = 60
bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60

p.s. Sorry for my English :)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Ludovic Orban-2
Are you using the official release train (version 2.1.3 and earlier) or the bitronix-hp version maintained by Brett?

On Wed, Dec 5, 2012 at 12:03 PM, Randll <[hidden email]> wrote:

Hi guys!

Sometimes i've got an error in bitronix connection.
Like this one - http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
Or "transaction timed out"
Or something else.

After exception occured connection in connection pool remains broken and
can't be used again. If I try to use this connection again I got an error

... Hibernate exception...
......
Caused by: java.sql.SQLException: error enlisting a ConnectionJavaProxy of a
JdbcPooledConnection from datasource ItemDB_2_xa in state ACCESSIBLE with
usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on Pooled
connection wrapping physical connection
org.postgresql.jdbc4.Jdbc4Connection@70f71024
        at
bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
        at
bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
        at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at
bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
        at
bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
        at
bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
        at
org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
        at
org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
        at
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
        at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
        at org.hibernate.loader.Loader.doQuery(Loader.java:717)
        at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
        at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
        ... 41 more
Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an
XAResourceHolderState with uniqueName=ItemDB_2_xa
XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a Bitronix XID
[323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63],
error=XAER_RMERR
        at
bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
        at
bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
        at
bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
        ... 55 more
Caused by: org.postgresql.xa.PGXAException: Transaction interleaving not
implemented
        at org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
        at
bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
        at
bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
        at
bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
        ... 57 more


What am I doing wrong? What shoud I do to clear the connection properly?

My code to run transactions:

    UserTransaction transaction =
TransactionManagerServices.getTransactionManager();
    setTimeout(transaction);
    transaction.begin();
    boolean rollback = false;
    try {
      callback.execute();
    } catch (Throwable e) {
      rollback = true;
      throw e;
    } finally {
      if (rollback)
        transaction.rollback();
      else
        transaction.commit();
    }

jta.properties

bitronix.tm.serverId=local_shard
bitronix.tm.2pc.async=false
bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
bitronix.tm.2pc.debugZeroResourceTransactions = false
bitronix.tm.disableJmx=true
bitronix.tm.synchronousJmxRegistration = true
bitronix.tm.currentNodeOnlyRecovery=true
bitronix.tm.allowMultipleLrc = false

bitronix.tm.journal = disk
bitronix.tm.journal.disk.forcedWriteEnabled = true
bitronix.tm.journal.disk.forceBatchingEnabled = true
bitronix.tm.journal.disk.skipCorruptedLogs = false
bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
bitronix.tm.journal.disk.maxLogSize = 1
bitronix.tm.journal.disk.filterLogStatus = true

bitronix.tm.timer.defaultTransactionTimeout = 60
bitronix.tm.timer.gracefulShutdownInterval = 60
bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60

p.s. Sorry for my English :)
--
View this message in context: http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761364.html
Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Andrew Frolov
Now I am using bitronix-hp compiled from yesterday sources. :)

But I had almost the same errors with official bitronix jar. Unfortunately I can't find old logs and prove it. :(
Maybe I am wrong, thinking it was the same error.

Ok, let's consider it is bitronix-hp problem.


Ludovic Orban-2 wrote
Are you using the official release train (version 2.1.3 and earlier) or the
bitronix-hp version maintained by Brett?

On Wed, Dec 5, 2012 at 12:03 PM, Randll <andrewfrolov@gmail.com> wrote:

>
> Hi guys!
>
> Sometimes i've got an error in bitronix connection.
> Like this one -
> http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
> Or "transaction timed out"
> Or something else.
>
> After exception occured connection in connection pool remains broken and
> can't be used again. If I try to use this connection again I got an error
>
> ... Hibernate exception...
> ......
> Caused by: java.sql.SQLException: error enlisting a ConnectionJavaProxy of
> a
> JdbcPooledConnection from datasource ItemDB_2_xa in state ACCESSIBLE with
> usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on Pooled
> connection wrapping physical connection
> org.postgresql.jdbc4.Jdbc4Connection@70f71024
>         at
>
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
>         at
>
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
>         at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at
> bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
>         at
>
> bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
>         at
>
> bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
>         at
>
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
>         at
>
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
>         at
>
> org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
>         at
> org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
>         at org.hibernate.loader.Loader.doQuery(Loader.java:717)
>         at
>
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
>         at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
>         ... 41 more
> Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an
> XAResourceHolderState with uniqueName=ItemDB_2_xa
> XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a Bitronix
> XID
> [323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63],
> error=XAER_RMERR
>         at
>
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
>         at
>
> bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
>         at
>
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
>         ... 55 more
> Caused by: org.postgresql.xa.PGXAException: Transaction interleaving not
> implemented
>         at org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
>         at
>
> bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
>         at
> bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
>         at
>
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
>         ... 57 more
>
>
> What am I doing wrong? What shoud I do to clear the connection properly?
>
> My code to run transactions:
>
>     UserTransaction transaction =
> TransactionManagerServices.getTransactionManager();
>     setTimeout(transaction);
>     transaction.begin();
>     boolean rollback = false;
>     try {
>       callback.execute();
>     } catch (Throwable e) {
>       rollback = true;
>       throw e;
>     } finally {
>       if (rollback)
>         transaction.rollback();
>       else
>         transaction.commit();
>     }
>
> jta.properties
>
> bitronix.tm.serverId=local_shard
> bitronix.tm.2pc.async=false
> bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
> bitronix.tm.2pc.debugZeroResourceTransactions = false
> bitronix.tm.disableJmx=true
> bitronix.tm.synchronousJmxRegistration = true
> bitronix.tm.currentNodeOnlyRecovery=true
> bitronix.tm.allowMultipleLrc = false
>
> bitronix.tm.journal = disk
> bitronix.tm.journal.disk.forcedWriteEnabled = true
> bitronix.tm.journal.disk.forceBatchingEnabled = true
> bitronix.tm.journal.disk.skipCorruptedLogs = false
> bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
> bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
> bitronix.tm.journal.disk.maxLogSize = 1
> bitronix.tm.journal.disk.filterLogStatus = true
>
> bitronix.tm.timer.defaultTransactionTimeout = 60
> bitronix.tm.timer.gracefulShutdownInterval = 60
> bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60
>
> p.s. Sorry for my English :)
> --
> View this message in context:
> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761364.html
> Sent from the Bitronix Transaction Manager mailing list archive at
> Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Brett Wooldridge-2
Randll,

I've been running some transaction load tests with 4 threads on a quad-core box and I've been unable to reproduce the issue so far.  Race conditions are notoriously difficult to reproduce.

If possible, can you enable debug logging for the package 'bitronix.tm.journal'?  That debug log file is going to roll frequently, so you may have to set it's rollover size to be large in order to capture the logs at the time of failure.

After a visual inspection of the code, I did find one place where a record length calculation could possibly skipped, and I have fixed that code.  If you want to give it another try with that latest code, it would be useful.

Re: a broken connection remaining in the pool, this is an issue I used to encounter with the old Bitronix (pre 2.0) code and I believe was fixed.  It seems my refactor of the XAPool might suffer the same bug, I'll try to create a reproduction test case and fix the bug tomorrow.

Regards,
Brett



On Wed, Dec 5, 2012 at 9:08 PM, Randll <[hidden email]> wrote:

Now I am using bitronix-hp compiled from yesterday sources. :)

But I had almost the same errors with official bitronix jar. Unfortunately I
can't find old logs and prove it. :(
Maybe I am wrong, thinking it was the same error.

Ok, let's consider it is bitronix-hp problem.



Ludovic Orban-2 wrote:
>
> Are you using the official release train (version 2.1.3 and earlier) or
> the
> bitronix-hp version maintained by Brett?
>
> On Wed, Dec 5, 2012 at 12:03 PM, Randll <[hidden email]> wrote:
>
>>
>> Hi guys!
>>
>> Sometimes i've got an error in bitronix connection.
>> Like this one -
>> http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
>> Or "transaction timed out"
>> Or something else.
>>
>> After exception occured connection in connection pool remains broken and
>> can't be used again. If I try to use this connection again I got an error
>>
>> ... Hibernate exception...
>> ......
>> Caused by: java.sql.SQLException: error enlisting a ConnectionJavaProxy
>> of
>> a
>> JdbcPooledConnection from datasource ItemDB_2_xa in state ACCESSIBLE with
>> usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on
>> Pooled
>> connection wrapping physical connection
>> org.postgresql.jdbc4.Jdbc4Connection@70f71024
>>         at
>>
>> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
>>         at
>>
>> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
>>         at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
>>         at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:601)
>>         at
>> bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
>>         at
>>
>> bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
>>         at
>>
>> bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
>>         at
>>
>> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
>>         at
>>
>> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
>>         at
>>
>> org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
>>         at
>> org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
>>         at org.hibernate.loader.Loader.doQuery(Loader.java:717)
>>         at
>>
>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
>>         at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
>>         ... 41 more
>> Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an
>> XAResourceHolderState with uniqueName=ItemDB_2_xa
>> XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a Bitronix
>> XID
>> [323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63],
>> error=XAER_RMERR
>>         at
>>
>> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
>>         at
>>
>> bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
>>         at
>>
>> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
>>         ... 55 more
>> Caused by: org.postgresql.xa.PGXAException: Transaction interleaving not
>> implemented
>>         at
>> org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
>>         at
>>
>> bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
>>         at
>> bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
>>         at
>>
>> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
>>         ... 57 more
>>
>>
>> What am I doing wrong? What shoud I do to clear the connection properly?
>>
>> My code to run transactions:
>>
>>     UserTransaction transaction =
>> TransactionManagerServices.getTransactionManager();
>>     setTimeout(transaction);
>>     transaction.begin();
>>     boolean rollback = false;
>>     try {
>>       callback.execute();
>>     } catch (Throwable e) {
>>       rollback = true;
>>       throw e;
>>     } finally {
>>       if (rollback)
>>         transaction.rollback();
>>       else
>>         transaction.commit();
>>     }
>>
>> jta.properties
>>
>> bitronix.tm.serverId=local_shard
>> bitronix.tm.2pc.async=false
>> bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
>> bitronix.tm.2pc.debugZeroResourceTransactions = false
>> bitronix.tm.disableJmx=true
>> bitronix.tm.synchronousJmxRegistration = true
>> bitronix.tm.currentNodeOnlyRecovery=true
>> bitronix.tm.allowMultipleLrc = false
>>
>> bitronix.tm.journal = disk
>> bitronix.tm.journal.disk.forcedWriteEnabled = true
>> bitronix.tm.journal.disk.forceBatchingEnabled = true
>> bitronix.tm.journal.disk.skipCorruptedLogs = false
>> bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
>> bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
>> bitronix.tm.journal.disk.maxLogSize = 1
>> bitronix.tm.journal.disk.filterLogStatus = true
>>
>> bitronix.tm.timer.defaultTransactionTimeout = 60
>> bitronix.tm.timer.gracefulShutdownInterval = 60
>> bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60
>>
>> p.s. Sorry for my English :)
>> --
>> View this message in context:
>> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761364.html
>> Sent from the Bitronix Transaction Manager mailing list archive at
>> Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
--
View this message in context: http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761563.html
Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Andrew Frolov
I will rerun my test with latest code and enabled debug tomorrow.

Thank for your help :)

Brett Wooldridge-2 wrote
Randll,

I've been running some transaction load tests with 4 threads on a quad-core
box and I've been unable to reproduce the issue so far.  Race conditions
are notoriously difficult to reproduce.

If possible, can you enable debug logging for the package
'bitronix.tm.journal'?  That debug log file is going to roll frequently, so
you may have to set it's rollover size to be large in order to capture the
logs at the time of failure.

After a visual inspection of the code, I did find one place where a record
length calculation could possibly skipped, and I have fixed that code.  If
you want to give it another try with that latest code, it would be useful.

Re: a broken connection remaining in the pool, this is an issue I used to
encounter with the old Bitronix (pre 2.0) code and I believe was fixed.  It
seems my refactor of the XAPool might suffer the same bug, I'll try to
create a reproduction test case and fix the bug tomorrow.

Regards,
Brett



On Wed, Dec 5, 2012 at 9:08 PM, Randll <andrewfrolov@gmail.com> wrote:

>
> Now I am using bitronix-hp compiled from yesterday sources. :)
>
> But I had almost the same errors with official bitronix jar. Unfortunately
> I
> can't find old logs and prove it. :(
> Maybe I am wrong, thinking it was the same error.
>
> Ok, let's consider it is bitronix-hp problem.
>
>
>
> Ludovic Orban-2 wrote:
> >
> > Are you using the official release train (version 2.1.3 and earlier) or
> > the
> > bitronix-hp version maintained by Brett?
> >
> > On Wed, Dec 5, 2012 at 12:03 PM, Randll <andrewfrolov@gmail.com> wrote:
> >
> >>
> >> Hi guys!
> >>
> >> Sometimes i've got an error in bitronix connection.
> >> Like this one -
> >> http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
> >> Or "transaction timed out"
> >> Or something else.
> >>
> >> After exception occured connection in connection pool remains broken and
> >> can't be used again. If I try to use this connection again I got an
> error
> >>
> >> ... Hibernate exception...
> >> ......
> >> Caused by: java.sql.SQLException: error enlisting a ConnectionJavaProxy
> >> of
> >> a
> >> JdbcPooledConnection from datasource ItemDB_2_xa in state ACCESSIBLE
> with
> >> usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on
> >> Pooled
> >> connection wrapping physical connection
> >> org.postgresql.jdbc4.Jdbc4Connection@70f71024
> >>         at
> >>
> >>
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
> >>         at
> >>
> >>
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
> >>         at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
> >>         at
> >>
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >>         at java.lang.reflect.Method.invoke(Method.java:601)
> >>         at
> >>
> bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
> >>         at
> >>
> >>
> bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
> >>         at
> >>
> >>
> bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
> >>         at
> >>
> >>
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
> >>         at
> >>
> >>
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
> >>         at
> >>
> >>
> org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
> >>         at
> >> org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
> >>         at org.hibernate.loader.Loader.doQuery(Loader.java:717)
> >>         at
> >>
> >>
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
> >>         at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
> >>         ... 41 more
> >> Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist
> an
> >> XAResourceHolderState with uniqueName=ItemDB_2_xa
> >> XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a
> Bitronix
> >> XID
> >> [323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63],
> >> error=XAER_RMERR
> >>         at
> >>
> >>
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
> >>         at
> >>
> >>
> bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
> >>         at
> >>
> >>
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
> >>         ... 55 more
> >> Caused by: org.postgresql.xa.PGXAException: Transaction interleaving not
> >> implemented
> >>         at
> >> org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
> >>         at
> >>
> >>
> bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
> >>         at
> >>
> bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
> >>         at
> >>
> >>
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
> >>         ... 57 more
> >>
> >>
> >> What am I doing wrong? What shoud I do to clear the connection properly?
> >>
> >> My code to run transactions:
> >>
> >>     UserTransaction transaction =
> >> TransactionManagerServices.getTransactionManager();
> >>     setTimeout(transaction);
> >>     transaction.begin();
> >>     boolean rollback = false;
> >>     try {
> >>       callback.execute();
> >>     } catch (Throwable e) {
> >>       rollback = true;
> >>       throw e;
> >>     } finally {
> >>       if (rollback)
> >>         transaction.rollback();
> >>       else
> >>         transaction.commit();
> >>     }
> >>
> >> jta.properties
> >>
> >> bitronix.tm.serverId=local_shard
> >> bitronix.tm.2pc.async=false
> >> bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
> >> bitronix.tm.2pc.debugZeroResourceTransactions = false
> >> bitronix.tm.disableJmx=true
> >> bitronix.tm.synchronousJmxRegistration = true
> >> bitronix.tm.currentNodeOnlyRecovery=true
> >> bitronix.tm.allowMultipleLrc = false
> >>
> >> bitronix.tm.journal = disk
> >> bitronix.tm.journal.disk.forcedWriteEnabled = true
> >> bitronix.tm.journal.disk.forceBatchingEnabled = true
> >> bitronix.tm.journal.disk.skipCorruptedLogs = false
> >> bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
> >> bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
> >> bitronix.tm.journal.disk.maxLogSize = 1
> >> bitronix.tm.journal.disk.filterLogStatus = true
> >>
> >> bitronix.tm.timer.defaultTransactionTimeout = 60
> >> bitronix.tm.timer.gracefulShutdownInterval = 60
> >> bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60
> >>
> >> p.s. Sorry for my English :)
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761364.html
> >> Sent from the Bitronix Transaction Manager mailing list archive at
> >> Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe from this list, please visit:
> >>
> >>     http://xircles.codehaus.org/manage_email
> >>
> >>
> >>
> >
> >
> --
> View this message in context:
> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761563.html
> Sent from the Bitronix Transaction Manager mailing list archive at
> Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Brett Wooldridge-2
Randll,

You mentioned running 6000 transactions per second or so.  Do you have an idea of how many resources are in a single transaction?  Your stacktrace indicated that we tried to write the log position in the transaction log header, but it was substantially larger than the configured maximum log file size.  For example, your log is configured for a maximum size of 1MB, but somehow our offset reached 31,457,301 (~30MB).

Thanks for helping knock the kinks out of the new code.

Regards,
Brett


On Wed, Dec 5, 2012 at 11:13 PM, Randll <[hidden email]> wrote:

I will rerun my test with latest code and enabled debug tomorrow.

Thank for your help :)


Brett Wooldridge-2 wrote:
>
> Randll,
>
> I've been running some transaction load tests with 4 threads on a
> quad-core
> box and I've been unable to reproduce the issue so far.  Race conditions
> are notoriously difficult to reproduce.
>
> If possible, can you enable debug logging for the package
> 'bitronix.tm.journal'?  That debug log file is going to roll frequently,
> so
> you may have to set it's rollover size to be large in order to capture the
> logs at the time of failure.
>
> After a visual inspection of the code, I did find one place where a record
> length calculation could possibly skipped, and I have fixed that code.  If
> you want to give it another try with that latest code, it would be useful.
>
> Re: a broken connection remaining in the pool, this is an issue I used to
> encounter with the old Bitronix (pre 2.0) code and I believe was fixed.
> It
> seems my refactor of the XAPool might suffer the same bug, I'll try to
> create a reproduction test case and fix the bug tomorrow.
>
> Regards,
> Brett
>
>
>
> On Wed, Dec 5, 2012 at 9:08 PM, Randll <[hidden email]> wrote:
>
>>
>> Now I am using bitronix-hp compiled from yesterday sources. :)
>>
>> But I had almost the same errors with official bitronix jar.
>> Unfortunately
>> I
>> can't find old logs and prove it. :(
>> Maybe I am wrong, thinking it was the same error.
>>
>> Ok, let's consider it is bitronix-hp problem.
>>
>>
>>
>> Ludovic Orban-2 wrote:
>> >
>> > Are you using the official release train (version 2.1.3 and earlier) or
>> > the
>> > bitronix-hp version maintained by Brett?
>> >
>> > On Wed, Dec 5, 2012 at 12:03 PM, Randll <[hidden email]> wrote:
>> >
>> >>
>> >> Hi guys!
>> >>
>> >> Sometimes i've got an error in bitronix connection.
>> >> Like this one -
>> >> http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
>> >> Or "transaction timed out"
>> >> Or something else.
>> >>
>> >> After exception occured connection in connection pool remains broken
>> and
>> >> can't be used again. If I try to use this connection again I got an
>> error
>> >>
>> >> ... Hibernate exception...
>> >> ......
>> >> Caused by: java.sql.SQLException: error enlisting a
>> ConnectionJavaProxy
>> >> of
>> >> a
>> >> JdbcPooledConnection from datasource ItemDB_2_xa in state ACCESSIBLE
>> with
>> >> usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on
>> >> Pooled
>> >> connection wrapping physical connection
>> >> org.postgresql.jdbc4.Jdbc4Connection@70f71024
>> >>         at
>> >>
>> >>
>> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
>> >>         at
>> >>
>> >>
>> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
>> >>         at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown
>> Source)
>> >>         at
>> >>
>> >>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> >>         at java.lang.reflect.Method.invoke(Method.java:601)
>> >>         at
>> >>
>> bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
>> >>         at
>> >>
>> >>
>> bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
>> >>         at
>> >>
>> >>
>> bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
>> >>         at
>> >>
>> >>
>> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
>> >>         at
>> >>
>> >>
>> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
>> >>         at
>> >>
>> >>
>> org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
>> >>         at
>> >> org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
>> >>         at org.hibernate.loader.Loader.doQuery(Loader.java:717)
>> >>         at
>> >>
>> >>
>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
>> >>         at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
>> >>         ... 41 more
>> >> Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist
>> an
>> >> XAResourceHolderState with uniqueName=ItemDB_2_xa
>> >> XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a
>> Bitronix
>> >> XID
>> >> [323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63],
>> >> error=XAER_RMERR
>> >>         at
>> >>
>> >>
>> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
>> >>         at
>> >>
>> >>
>> bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
>> >>         at
>> >>
>> >>
>> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
>> >>         ... 55 more
>> >> Caused by: org.postgresql.xa.PGXAException: Transaction interleaving
>> not
>> >> implemented
>> >>         at
>> >> org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
>> >>         at
>> >>
>> >>
>> bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
>> >>         at
>> >>
>> bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
>> >>         at
>> >>
>> >>
>> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
>> >>         ... 57 more
>> >>
>> >>
>> >> What am I doing wrong? What shoud I do to clear the connection
>> properly?
>> >>
>> >> My code to run transactions:
>> >>
>> >>     UserTransaction transaction =
>> >> TransactionManagerServices.getTransactionManager();
>> >>     setTimeout(transaction);
>> >>     transaction.begin();
>> >>     boolean rollback = false;
>> >>     try {
>> >>       callback.execute();
>> >>     } catch (Throwable e) {
>> >>       rollback = true;
>> >>       throw e;
>> >>     } finally {
>> >>       if (rollback)
>> >>         transaction.rollback();
>> >>       else
>> >>         transaction.commit();
>> >>     }
>> >>
>> >> jta.properties
>> >>
>> >> bitronix.tm.serverId=local_shard
>> >> bitronix.tm.2pc.async=false
>> >> bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
>> >> bitronix.tm.2pc.debugZeroResourceTransactions = false
>> >> bitronix.tm.disableJmx=true
>> >> bitronix.tm.synchronousJmxRegistration = true
>> >> bitronix.tm.currentNodeOnlyRecovery=true
>> >> bitronix.tm.allowMultipleLrc = false
>> >>
>> >> bitronix.tm.journal = disk
>> >> bitronix.tm.journal.disk.forcedWriteEnabled = true
>> >> bitronix.tm.journal.disk.forceBatchingEnabled = true
>> >> bitronix.tm.journal.disk.skipCorruptedLogs = false
>> >> bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
>> >> bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
>> >> bitronix.tm.journal.disk.maxLogSize = 1
>> >> bitronix.tm.journal.disk.filterLogStatus = true
>> >>
>> >> bitronix.tm.timer.defaultTransactionTimeout = 60
>> >> bitronix.tm.timer.gracefulShutdownInterval = 60
>> >> bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60
>> >>
>> >> p.s. Sorry for my English :)
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761364.html
>> >> Sent from the Bitronix Transaction Manager mailing list archive at
>> >> Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe from this list, please visit:
>> >>
>> >>     http://xircles.codehaus.org/manage_email
>> >>
>> >>
>> >>
>> >
>> >
>> --
>> View this message in context:
>> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761563.html
>> Sent from the Bitronix Transaction Manager mailing list archive at
>> Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
--
View this message in context: http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761987.html
Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Andrew Frolov
6000 tps - total. Almost all of them are not xa, so they use 1 resource. XA transactions - 50-70 per second. They use 2 and in some cases up to 5 resources. All resources are JDBC connections to PostgreSQL database.

About 1 mb. Sorry, my fault. I double checked my settings.. This particular test used 30MB trx log.

Brett Wooldridge-2 wrote
Randll,

You mentioned running 6000 transactions per second or so.  Do you have an
idea of how many resources are in a single transaction?  Your stacktrace
indicated that we tried to write the log position in the transaction log
header, but it was substantially larger than the configured maximum log
file size.  For example, your log is configured for a maximum size of 1MB,
but somehow our offset reached 31,457,301 (~30MB).

Thanks for helping knock the kinks out of the new code.

Regards,
Brett


On Wed, Dec 5, 2012 at 11:13 PM, Randll <andrewfrolov@gmail.com> wrote:

>
> I will rerun my test with latest code and enabled debug tomorrow.
>
> Thank for your help :)
>
>
> Brett Wooldridge-2 wrote:
> >
> > Randll,
> >
> > I've been running some transaction load tests with 4 threads on a
> > quad-core
> > box and I've been unable to reproduce the issue so far.  Race conditions
> > are notoriously difficult to reproduce.
> >
> > If possible, can you enable debug logging for the package
> > 'bitronix.tm.journal'?  That debug log file is going to roll frequently,
> > so
> > you may have to set it's rollover size to be large in order to capture
> the
> > logs at the time of failure.
> >
> > After a visual inspection of the code, I did find one place where a
> record
> > length calculation could possibly skipped, and I have fixed that code.
>  If
> > you want to give it another try with that latest code, it would be
> useful.
> >
> > Re: a broken connection remaining in the pool, this is an issue I used to
> > encounter with the old Bitronix (pre 2.0) code and I believe was fixed.
> > It
> > seems my refactor of the XAPool might suffer the same bug, I'll try to
> > create a reproduction test case and fix the bug tomorrow.
> >
> > Regards,
> > Brett
> >
> >
> >
> > On Wed, Dec 5, 2012 at 9:08 PM, Randll <andrewfrolov@gmail.com> wrote:
> >
> >>
> >> Now I am using bitronix-hp compiled from yesterday sources. :)
> >>
> >> But I had almost the same errors with official bitronix jar.
> >> Unfortunately
> >> I
> >> can't find old logs and prove it. :(
> >> Maybe I am wrong, thinking it was the same error.
> >>
> >> Ok, let's consider it is bitronix-hp problem.
> >>
> >>
> >>
> >> Ludovic Orban-2 wrote:
> >> >
> >> > Are you using the official release train (version 2.1.3 and earlier)
> or
> >> > the
> >> > bitronix-hp version maintained by Brett?
> >> >
> >> > On Wed, Dec 5, 2012 at 12:03 PM, Randll <andrewfrolov@gmail.com>
> wrote:
> >> >
> >> >>
> >> >> Hi guys!
> >> >>
> >> >> Sometimes i've got an error in bitronix connection.
> >> >> Like this one -
> >> >> http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
> >> >> Or "transaction timed out"
> >> >> Or something else.
> >> >>
> >> >> After exception occured connection in connection pool remains broken
> >> and
> >> >> can't be used again. If I try to use this connection again I got an
> >> error
> >> >>
> >> >> ... Hibernate exception...
> >> >> ......
> >> >> Caused by: java.sql.SQLException: error enlisting a
> >> ConnectionJavaProxy
> >> >> of
> >> >> a
> >> >> JdbcPooledConnection from datasource ItemDB_2_xa in state ACCESSIBLE
> >> with
> >> >> usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on
> >> >> Pooled
> >> >> connection wrapping physical connection
> >> >> org.postgresql.jdbc4.Jdbc4Connection@70f71024
> >> >>         at
> >> >>
> >> >>
> >>
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
> >> >>         at
> >> >>
> >> >>
> >>
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
> >> >>         at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown
> >> Source)
> >> >>         at
> >> >>
> >> >>
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> >>         at java.lang.reflect.Method.invoke(Method.java:601)
> >> >>         at
> >> >>
> >>
> bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
> >> >>         at
> >> >>
> >> >>
> >>
> bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
> >> >>         at
> >> >>
> >> >>
> >>
> bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
> >> >>         at
> >> >>
> >> >>
> >>
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
> >> >>         at
> >> >>
> >> >>
> >>
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
> >> >>         at
> >> >>
> >> >>
> >>
> org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
> >> >>         at
> >> >> org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
> >> >>         at org.hibernate.loader.Loader.doQuery(Loader.java:717)
> >> >>         at
> >> >>
> >> >>
> >>
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
> >> >>         at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
> >> >>         ... 41 more
> >> >> Caused by: bitronix.tm.internal.BitronixSystemException: cannot
> enlist
> >> an
> >> >> XAResourceHolderState with uniqueName=ItemDB_2_xa
> >> >> XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a
> >> Bitronix
> >> >> XID
> >> >> [323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63],
> >> >> error=XAER_RMERR
> >> >>         at
> >> >>
> >> >>
> >>
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
> >> >>         at
> >> >>
> >> >>
> >>
> bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
> >> >>         at
> >> >>
> >> >>
> >>
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
> >> >>         ... 55 more
> >> >> Caused by: org.postgresql.xa.PGXAException: Transaction interleaving
> >> not
> >> >> implemented
> >> >>         at
> >> >> org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
> >> >>         at
> >> >>
> >> >>
> >>
> bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
> >> >>         at
> >> >>
> >>
> bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
> >> >>         at
> >> >>
> >> >>
> >>
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
> >> >>         ... 57 more
> >> >>
> >> >>
> >> >> What am I doing wrong? What shoud I do to clear the connection
> >> properly?
> >> >>
> >> >> My code to run transactions:
> >> >>
> >> >>     UserTransaction transaction =
> >> >> TransactionManagerServices.getTransactionManager();
> >> >>     setTimeout(transaction);
> >> >>     transaction.begin();
> >> >>     boolean rollback = false;
> >> >>     try {
> >> >>       callback.execute();
> >> >>     } catch (Throwable e) {
> >> >>       rollback = true;
> >> >>       throw e;
> >> >>     } finally {
> >> >>       if (rollback)
> >> >>         transaction.rollback();
> >> >>       else
> >> >>         transaction.commit();
> >> >>     }
> >> >>
> >> >> jta.properties
> >> >>
> >> >> bitronix.tm.serverId=local_shard
> >> >> bitronix.tm.2pc.async=false
> >> >> bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
> >> >> bitronix.tm.2pc.debugZeroResourceTransactions = false
> >> >> bitronix.tm.disableJmx=true
> >> >> bitronix.tm.synchronousJmxRegistration = true
> >> >> bitronix.tm.currentNodeOnlyRecovery=true
> >> >> bitronix.tm.allowMultipleLrc = false
> >> >>
> >> >> bitronix.tm.journal = disk
> >> >> bitronix.tm.journal.disk.forcedWriteEnabled = true
> >> >> bitronix.tm.journal.disk.forceBatchingEnabled = true
> >> >> bitronix.tm.journal.disk.skipCorruptedLogs = false
> >> >> bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
> >> >> bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
> >> >> bitronix.tm.journal.disk.maxLogSize = 1
> >> >> bitronix.tm.journal.disk.filterLogStatus = true
> >> >>
> >> >> bitronix.tm.timer.defaultTransactionTimeout = 60
> >> >> bitronix.tm.timer.gracefulShutdownInterval = 60
> >> >> bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60
> >> >>
> >> >> p.s. Sorry for my English :)
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761364.html
> >> >> Sent from the Bitronix Transaction Manager mailing list archive at
> >> >> Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe from this list, please visit:
> >> >>
> >> >>     http://xircles.codehaus.org/manage_email
> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761563.html
> >> Sent from the Bitronix Transaction Manager mailing list archive at
> >> Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe from this list, please visit:
> >>
> >>     http://xircles.codehaus.org/manage_email
> >>
> >>
> >>
> >
> >
> --
> View this message in context:
> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761987.html
> Sent from the Bitronix Transaction Manager mailing list archive at
> Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Brett Wooldridge-2
Ah, that make me feel better.  I think you hit the log rollover boundary case I fixed last night; a simple >= that should have been a > that allowed a log entry to attempt a write beyond the end of the file.

Sent from my iPhone

On Dec 6, 2012, at 12:31 AM, Randll <[hidden email]> wrote:

>
> 6000 tps - total. Almost all of them are not xa, so they use 1 resource. XA
> transactions - 50-70 per second. They use 2 and in come cases up to 5
> resources. All resources are JDBC connections to PostgreSQL database.
>
> About 1 mb. Sorry, my fault. I double checked my settings.. This particular
> test used 30MB trx log.
>
>
> Brett Wooldridge-2 wrote:
>>
>> Randll,
>>
>> You mentioned running 6000 transactions per second or so.  Do you have an
>> idea of how many resources are in a single transaction?  Your stacktrace
>> indicated that we tried to write the log position in the transaction log
>> header, but it was substantially larger than the configured maximum log
>> file size.  For example, your log is configured for a maximum size of 1MB,
>> but somehow our offset reached 31,457,301 (~30MB).
>>
>> Thanks for helping knock the kinks out of the new code.
>>
>> Regards,
>> Brett
>>
>>
>> On Wed, Dec 5, 2012 at 11:13 PM, Randll <[hidden email]> wrote:
>>
>>>
>>> I will rerun my test with latest code and enabled debug tomorrow.
>>>
>>> Thank for your help :)
>>>
>>>
>>> Brett Wooldridge-2 wrote:
>>>>
>>>> Randll,
>>>>
>>>> I've been running some transaction load tests with 4 threads on a
>>>> quad-core
>>>> box and I've been unable to reproduce the issue so far.  Race
>>> conditions
>>>> are notoriously difficult to reproduce.
>>>>
>>>> If possible, can you enable debug logging for the package
>>>> 'bitronix.tm.journal'?  That debug log file is going to roll
>>> frequently,
>>>> so
>>>> you may have to set it's rollover size to be large in order to capture
>>> the
>>>> logs at the time of failure.
>>>>
>>>> After a visual inspection of the code, I did find one place where a
>>> record
>>>> length calculation could possibly skipped, and I have fixed that code.
>>> If
>>>> you want to give it another try with that latest code, it would be
>>> useful.
>>>>
>>>> Re: a broken connection remaining in the pool, this is an issue I used
>>> to
>>>> encounter with the old Bitronix (pre 2.0) code and I believe was fixed.
>>>> It
>>>> seems my refactor of the XAPool might suffer the same bug, I'll try to
>>>> create a reproduction test case and fix the bug tomorrow.
>>>>
>>>> Regards,
>>>> Brett
>>>>
>>>>
>>>>
>>>> On Wed, Dec 5, 2012 at 9:08 PM, Randll <[hidden email]> wrote:
>>>>
>>>>>
>>>>> Now I am using bitronix-hp compiled from yesterday sources. :)
>>>>>
>>>>> But I had almost the same errors with official bitronix jar.
>>>>> Unfortunately
>>>>> I
>>>>> can't find old logs and prove it. :(
>>>>> Maybe I am wrong, thinking it was the same error.
>>>>>
>>>>> Ok, let's consider it is bitronix-hp problem.
>>>>>
>>>>>
>>>>>
>>>>> Ludovic Orban-2 wrote:
>>>>>>
>>>>>> Are you using the official release train (version 2.1.3 and earlier)
>>> or
>>>>>> the
>>>>>> bitronix-hp version maintained by Brett?
>>>>>>
>>>>>> On Wed, Dec 5, 2012 at 12:03 PM, Randll <[hidden email]>
>>> wrote:
>>>>>>
>>>>>>>
>>>>>>> Hi guys!
>>>>>>>
>>>>>>> Sometimes i've got an error in bitronix connection.
>>>>>>> Like this one -
>>>>>>> http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
>>>>>>> Or "transaction timed out"
>>>>>>> Or something else.
>>>>>>>
>>>>>>> After exception occured connection in connection pool remains
>>> broken
>>>>> and
>>>>>>> can't be used again. If I try to use this connection again I got an
>>>>> error
>>>>>>>
>>>>>>> ... Hibernate exception...
>>>>>>> ......
>>>>>>> Caused by: java.sql.SQLException: error enlisting a
>>>>> ConnectionJavaProxy
>>>>>>> of
>>>>>>> a
>>>>>>> JdbcPooledConnection from datasource ItemDB_2_xa in state
>>> ACCESSIBLE
>>>>> with
>>>>>>> usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on
>>>>>>> Pooled
>>>>>>> connection wrapping physical connection
>>>>>>> org.postgresql.jdbc4.Jdbc4Connection@70f71024
>>>>>>>        at
>>> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
>>>>>>>        at
>>> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
>>>>>>>        at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown
>>>>> Source)
>>>>>>>        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>>>        at java.lang.reflect.Method.invoke(Method.java:601)
>>>>>>>        at
>>> bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
>>>>>>>        at
>>> bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
>>>>>>>        at
>>> bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
>>>>>>>        at
>>> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
>>>>>>>        at
>>> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
>>>>>>>        at
>>> org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
>>>>>>>        at
>>>>>>> org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
>>>>>>>        at org.hibernate.loader.Loader.doQuery(Loader.java:717)
>>>>>>>        at
>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
>>>>>>>        at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
>>>>>>>        ... 41 more
>>>>>>> Caused by: bitronix.tm.internal.BitronixSystemException: cannot
>>> enlist
>>>>> an
>>>>>>> XAResourceHolderState with uniqueName=ItemDB_2_xa
>>>>>>> XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a
>>>>> Bitronix
>>>>>>> XID
>>>>>>> [323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63],
>>>>>>> error=XAER_RMERR
>>>>>>>        at
>>> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
>>>>>>>        at
>>> bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
>>>>>>>        at
>>> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
>>>>>>>        ... 55 more
>>>>>>> Caused by: org.postgresql.xa.PGXAException: Transaction
>>> interleaving
>>>>> not
>>>>>>> implemented
>>>>>>>        at
>>>>>>> org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
>>>>>>>        at
>>> bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
>>>>>>>        at
>>> bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
>>>>>>>        at
>>> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
>>>>>>>        ... 57 more
>>>>>>>
>>>>>>>
>>>>>>> What am I doing wrong? What shoud I do to clear the connection
>>>>> properly?
>>>>>>>
>>>>>>> My code to run transactions:
>>>>>>>
>>>>>>>    UserTransaction transaction =
>>>>>>> TransactionManagerServices.getTransactionManager();
>>>>>>>    setTimeout(transaction);
>>>>>>>    transaction.begin();
>>>>>>>    boolean rollback = false;
>>>>>>>    try {
>>>>>>>      callback.execute();
>>>>>>>    } catch (Throwable e) {
>>>>>>>      rollback = true;
>>>>>>>      throw e;
>>>>>>>    } finally {
>>>>>>>      if (rollback)
>>>>>>>        transaction.rollback();
>>>>>>>      else
>>>>>>>        transaction.commit();
>>>>>>>    }
>>>>>>>
>>>>>>> jta.properties
>>>>>>>
>>>>>>> bitronix.tm.serverId=local_shard
>>>>>>> bitronix.tm.2pc.async=false
>>>>>>> bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
>>>>>>> bitronix.tm.2pc.debugZeroResourceTransactions = false
>>>>>>> bitronix.tm.disableJmx=true
>>>>>>> bitronix.tm.synchronousJmxRegistration = true
>>>>>>> bitronix.tm.currentNodeOnlyRecovery=true
>>>>>>> bitronix.tm.allowMultipleLrc = false
>>>>>>>
>>>>>>> bitronix.tm.journal = disk
>>>>>>> bitronix.tm.journal.disk.forcedWriteEnabled = true
>>>>>>> bitronix.tm.journal.disk.forceBatchingEnabled = true
>>>>>>> bitronix.tm.journal.disk.skipCorruptedLogs = false
>>>>>>> bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
>>>>>>> bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
>>>>>>> bitronix.tm.journal.disk.maxLogSize = 1
>>>>>>> bitronix.tm.journal.disk.filterLogStatus = true
>>>>>>>
>>>>>>> bitronix.tm.timer.defaultTransactionTimeout = 60
>>>>>>> bitronix.tm.timer.gracefulShutdownInterval = 60
>>>>>>> bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60
>>>>>>>
>>>>>>> p.s. Sorry for my English :)
>>>>>>> --
>>>>>>> View this message in context:
>>> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761364.html
>>>>>>> Sent from the Bitronix Transaction Manager mailing list archive at
>>>>>>> Nabble.com.
>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe from this list, please visit:
>>>>>>>
>>>>>>>    http://xircles.codehaus.org/manage_email
>>>>> --
>>>>> View this message in context:
>>> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761563.html
>>>>> Sent from the Bitronix Transaction Manager mailing list archive at
>>>>> Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe from this list, please visit:
>>>>>
>>>>>    http://xircles.codehaus.org/manage_email
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761987.html
>>> Sent from the Bitronix Transaction Manager mailing list archive at
>>> Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>
> --
> View this message in context: http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34762302.html
> Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Brett Wooldridge-2
In reply to this post by Andrew Frolov
Randll,

Searching for "Transaction interleaving not implemented" yields quite a few threads on PostgreSQL and transaction join semantics.  I didn't see it in your config, but you should set useTmJoin to false.

Brett

Sent from my iPhone

On Dec 5, 2012, at 8:03 PM, Randll <[hidden email]> wrote:

>
> Hi guys!
>
> Sometimes i've got an error in bitronix connection.
> Like this one - http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
> Or "transaction timed out"
> Or something else.
>
> After exception occured connection in connection pool remains broken and
> can't be used again. If I try to use this connection again I got an error
>
> ... Hibernate exception...
> ......
> Caused by: java.sql.SQLException: error enlisting a ConnectionJavaProxy of a
> JdbcPooledConnection from datasource ItemDB_2_xa in state ACCESSIBLE with
> usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on Pooled
> connection wrapping physical connection
> org.postgresql.jdbc4.Jdbc4Connection@70f71024
>    at
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
>    at
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
>    at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
>    at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>    at java.lang.reflect.Method.invoke(Method.java:601)
>    at
> bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
>    at
> bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
>    at
> bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
>    at
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
>    at
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
>    at
> org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
>    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
>    at org.hibernate.loader.Loader.doQuery(Loader.java:717)
>    at
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
>    at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
>    ... 41 more
> Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an
> XAResourceHolderState with uniqueName=ItemDB_2_xa
> XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a Bitronix XID
> [323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63],
> error=XAER_RMERR
>    at
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
>    at
> bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
>    at
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
>    ... 55 more
> Caused by: org.postgresql.xa.PGXAException: Transaction interleaving not
> implemented
>    at org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
>    at
> bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
>    at
> bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
>    at
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
>    ... 57 more
>
>
> What am I doing wrong? What shoud I do to clear the connection properly?
>
> My code to run transactions:
>
>    UserTransaction transaction =
> TransactionManagerServices.getTransactionManager();
>    setTimeout(transaction);
>    transaction.begin();
>    boolean rollback = false;
>    try {
>      callback.execute();
>    } catch (Throwable e) {
>      rollback = true;
>      throw e;
>    } finally {
>      if (rollback)
>        transaction.rollback();
>      else
>        transaction.commit();
>    }
>
> jta.properties
>
> bitronix.tm.serverId=local_shard
> bitronix.tm.2pc.async=false
> bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
> bitronix.tm.2pc.debugZeroResourceTransactions = false
> bitronix.tm.disableJmx=true
> bitronix.tm.synchronousJmxRegistration = true
> bitronix.tm.currentNodeOnlyRecovery=true
> bitronix.tm.allowMultipleLrc = false
>
> bitronix.tm.journal = disk
> bitronix.tm.journal.disk.forcedWriteEnabled = true
> bitronix.tm.journal.disk.forceBatchingEnabled = true
> bitronix.tm.journal.disk.skipCorruptedLogs = false
> bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
> bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
> bitronix.tm.journal.disk.maxLogSize = 1
> bitronix.tm.journal.disk.filterLogStatus = true
>
> bitronix.tm.timer.defaultTransactionTimeout = 60
> bitronix.tm.timer.gracefulShutdownInterval = 60
> bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60
>
> p.s. Sorry for my English :)
> --
> View this message in context: http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761364.html
> Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Brett Wooldridge-2
In reply to this post by Andrew Frolov
Lastly, "forceBatchingEnabled" is no longer used if you are running my fork.  The setting won't throw an error, but it is no longer necessary.

Sent from my iPhone

On Dec 5, 2012, at 8:03 PM, Randll <[hidden email]> wrote:

>
> Hi guys!
>
> Sometimes i've got an error in bitronix connection.
> Like this one - http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
> Or "transaction timed out"
> Or something else.
>
> After exception occured connection in connection pool remains broken and
> can't be used again. If I try to use this connection again I got an error
>
> ... Hibernate exception...
> ......
> Caused by: java.sql.SQLException: error enlisting a ConnectionJavaProxy of a
> JdbcPooledConnection from datasource ItemDB_2_xa in state ACCESSIBLE with
> usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on Pooled
> connection wrapping physical connection
> org.postgresql.jdbc4.Jdbc4Connection@70f71024
>    at
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
>    at
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
>    at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
>    at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>    at java.lang.reflect.Method.invoke(Method.java:601)
>    at
> bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
>    at
> bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
>    at
> bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
>    at
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
>    at
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
>    at
> org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
>    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
>    at org.hibernate.loader.Loader.doQuery(Loader.java:717)
>    at
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
>    at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
>    ... 41 more
> Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an
> XAResourceHolderState with uniqueName=ItemDB_2_xa
> XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a Bitronix XID
> [323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63],
> error=XAER_RMERR
>    at
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
>    at
> bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
>    at
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
>    ... 55 more
> Caused by: org.postgresql.xa.PGXAException: Transaction interleaving not
> implemented
>    at org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
>    at
> bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
>    at
> bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
>    at
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
>    ... 57 more
>
>
> What am I doing wrong? What shoud I do to clear the connection properly?
>
> My code to run transactions:
>
>    UserTransaction transaction =
> TransactionManagerServices.getTransactionManager();
>    setTimeout(transaction);
>    transaction.begin();
>    boolean rollback = false;
>    try {
>      callback.execute();
>    } catch (Throwable e) {
>      rollback = true;
>      throw e;
>    } finally {
>      if (rollback)
>        transaction.rollback();
>      else
>        transaction.commit();
>    }
>
> jta.properties
>
> bitronix.tm.serverId=local_shard
> bitronix.tm.2pc.async=false
> bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
> bitronix.tm.2pc.debugZeroResourceTransactions = false
> bitronix.tm.disableJmx=true
> bitronix.tm.synchronousJmxRegistration = true
> bitronix.tm.currentNodeOnlyRecovery=true
> bitronix.tm.allowMultipleLrc = false
>
> bitronix.tm.journal = disk
> bitronix.tm.journal.disk.forcedWriteEnabled = true
> bitronix.tm.journal.disk.forceBatchingEnabled = true
> bitronix.tm.journal.disk.skipCorruptedLogs = false
> bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
> bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
> bitronix.tm.journal.disk.maxLogSize = 1
> bitronix.tm.journal.disk.filterLogStatus = true
>
> bitronix.tm.timer.defaultTransactionTimeout = 60
> bitronix.tm.timer.gracefulShutdownInterval = 60
> bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60
>
> p.s. Sorry for my English :)
> --
> View this message in context: http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761364.html
> Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Brett Wooldridge-2
Randll,

Sorry to email bomb you.  Just trying to address all issues and potential causes.  Make sure you are running the latest PostgreSQL driver (9.2-1002).  If you get any more exceptions (after making the useTmJoin=false change mentioned in my previous email), please post the full stacktrace.

Regards,
Brett




On Thu, Dec 6, 2012 at 11:23 AM, Brett Wooldridge <[hidden email]> wrote:
Lastly, "forceBatchingEnabled" is no longer used if you are running my fork.  The setting won't throw an error, but it is no longer necessary.

Sent from my iPhone

On Dec 5, 2012, at 8:03 PM, Randll <[hidden email]> wrote:

>
> Hi guys!
>
> Sometimes i've got an error in bitronix connection.
> Like this one - http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
> Or "transaction timed out"
> Or something else.
>
> After exception occured connection in connection pool remains broken and
> can't be used again. If I try to use this connection again I got an error
>
> ... Hibernate exception...
> ......
> Caused by: java.sql.SQLException: error enlisting a ConnectionJavaProxy of a
> JdbcPooledConnection from datasource ItemDB_2_xa in state ACCESSIBLE with
> usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on Pooled
> connection wrapping physical connection
> org.postgresql.jdbc4.Jdbc4Connection@70f71024
>    at
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
>    at
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
>    at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
>    at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>    at java.lang.reflect.Method.invoke(Method.java:601)
>    at
> bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
>    at
> bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
>    at
> bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
>    at
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
>    at
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
>    at
> org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
>    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
>    at org.hibernate.loader.Loader.doQuery(Loader.java:717)
>    at
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
>    at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
>    ... 41 more
> Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an
> XAResourceHolderState with uniqueName=ItemDB_2_xa
> XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a Bitronix XID
> [323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63],
> error=XAER_RMERR
>    at
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
>    at
> bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
>    at
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
>    ... 55 more
> Caused by: org.postgresql.xa.PGXAException: Transaction interleaving not
> implemented
>    at org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
>    at
> bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
>    at
> bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
>    at
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
>    ... 57 more
>
>
> What am I doing wrong? What shoud I do to clear the connection properly?
>
> My code to run transactions:
>
>    UserTransaction transaction =
> TransactionManagerServices.getTransactionManager();
>    setTimeout(transaction);
>    transaction.begin();
>    boolean rollback = false;
>    try {
>      callback.execute();
>    } catch (Throwable e) {
>      rollback = true;
>      throw e;
>    } finally {
>      if (rollback)
>        transaction.rollback();
>      else
>        transaction.commit();
>    }
>
> jta.properties
>
> bitronix.tm.serverId=local_shard
> bitronix.tm.2pc.async=false
> bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
> bitronix.tm.2pc.debugZeroResourceTransactions = false
> bitronix.tm.disableJmx=true
> bitronix.tm.synchronousJmxRegistration = true
> bitronix.tm.currentNodeOnlyRecovery=true
> bitronix.tm.allowMultipleLrc = false
>
> bitronix.tm.journal = disk
> bitronix.tm.journal.disk.forcedWriteEnabled = true
> bitronix.tm.journal.disk.forceBatchingEnabled = true
> bitronix.tm.journal.disk.skipCorruptedLogs = false
> bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
> bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
> bitronix.tm.journal.disk.maxLogSize = 1
> bitronix.tm.journal.disk.filterLogStatus = true
>
> bitronix.tm.timer.defaultTransactionTimeout = 60
> bitronix.tm.timer.gracefulShutdownInterval = 60
> bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60
>
> p.s. Sorry for my English :)
> --
> View this message in context: http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761364.html
> Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Andrew Frolov
What I did

removed forceBatchingEnabled
useTmJoin = false (was true)
shareTransactionConnections = false (was true)
updated PostgreSQL JDBC driver.
got latest sources

I will try to run the test today and report a results :)

Thanks a lot!

Brett Wooldridge-2 wrote
Randll,

Sorry to email bomb you.  Just trying to address all issues and potential
causes.  Make sure you are running the latest PostgreSQL driver (9.2-1002).
 If you get any more exceptions (after making the useTmJoin=false change
mentioned in my previous email), please post the full stacktrace.

Regards,
Brett




On Thu, Dec 6, 2012 at 11:23 AM, Brett Wooldridge <
brett.wooldridge@gmail.com> wrote:

> Lastly, "forceBatchingEnabled" is no longer used if you are running my
> fork.  The setting won't throw an error, but it is no longer necessary.
>
> Sent from my iPhone
>
> On Dec 5, 2012, at 8:03 PM, Randll <andrewfrolov@gmail.com> wrote:
>
> >
> > Hi guys!
> >
> > Sometimes i've got an error in bitronix connection.
> > Like this one -
> http://old.nabble.com/Re%3A-DiskJournal-lock-p34761330.html
> > Or "transaction timed out"
> > Or something else.
> >
> > After exception occured connection in connection pool remains broken and
> > can't be used again. If I try to use this connection again I got an error
> >
> > ... Hibernate exception...
> > ......
> > Caused by: java.sql.SQLException: error enlisting a ConnectionJavaProxy
> of a
> > JdbcPooledConnection from datasource ItemDB_2_xa in state ACCESSIBLE with
> > usage count 1 wrapping org.postgresql.xa.PGXAConnection@1443c7fc on
> Pooled
> > connection wrapping physical connection
> > org.postgresql.jdbc4.Jdbc4Connection@70f71024
> >    at
> >
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:397)
> >    at
> >
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.prepareStatement(ConnectionJavaProxy.java:236)
> >    at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
> >    at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >    at java.lang.reflect.Method.invoke(Method.java:601)
> >    at
> >
> bitronix.tm.resource.jdbc.proxy.JavaProxyBase.invoke(JavaProxyBase.java:55)
> >    at
> >
> bitronix.tm.resource.jdbc.proxy.JdbcCglibProxyFactory$Interceptor.intercept(JdbcCglibProxyFactory.java:207)
> >    at
> >
> bitronix.tm.resource.jdbc.PooledConnectionProxy$$EnhancerByCGLIB$$33f0b74e.prepareStatement(<generated>)
> >    at
> >
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
> >    at
> >
> org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
> >    at
> >
> org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
> >    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1616)
> >    at org.hibernate.loader.Loader.doQuery(Loader.java:717)
> >    at
> >
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
> >    at org.hibernate.loader.Loader.loadEntity(Loader.java:1953)
> >    ... 41 more
> > Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an
> > XAResourceHolderState with uniqueName=ItemDB_2_xa
> > XAResource=org.postgresql.xa.PGXAConnection@1443c7fc with XID a
> Bitronix XID
> > [323934000000018D6BE16200AB3E61 : 323934000000018D6BE16200AB3E63],
> > error=XAER_RMERR
> >    at
> >
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:111)
> >    at
> >
> bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:70)
> >    at
> >
> bitronix.tm.resource.jdbc.proxy.ConnectionJavaProxy.enlistResource(ConnectionJavaProxy.java:395)
> >    ... 55 more
> > Caused by: org.postgresql.xa.PGXAException: Transaction interleaving not
> > implemented
> >    at org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:212)
> >    at
> >
> bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:224)
> >    at
> > bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:111)
> >    at
> >
> bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:102)
> >    ... 57 more
> >
> >
> > What am I doing wrong? What shoud I do to clear the connection properly?
> >
> > My code to run transactions:
> >
> >    UserTransaction transaction =
> > TransactionManagerServices.getTransactionManager();
> >    setTimeout(transaction);
> >    transaction.begin();
> >    boolean rollback = false;
> >    try {
> >      callback.execute();
> >    } catch (Throwable e) {
> >      rollback = true;
> >      throw e;
> >    } finally {
> >      if (rollback)
> >        transaction.rollback();
> >      else
> >        transaction.commit();
> >    }
> >
> > jta.properties
> >
> > bitronix.tm.serverId=local_shard
> > bitronix.tm.2pc.async=false
> > bitronix.tm.2pc.warnAboutZeroResourceTransactions=false
> > bitronix.tm.2pc.debugZeroResourceTransactions = false
> > bitronix.tm.disableJmx=true
> > bitronix.tm.synchronousJmxRegistration = true
> > bitronix.tm.currentNodeOnlyRecovery=true
> > bitronix.tm.allowMultipleLrc = false
> >
> > bitronix.tm.journal = disk
> > bitronix.tm.journal.disk.forcedWriteEnabled = true
> > bitronix.tm.journal.disk.forceBatchingEnabled = true
> > bitronix.tm.journal.disk.skipCorruptedLogs = false
> > bitronix.tm.journal.disk.logPart1File = ./out/tx-logs/part1.btm
> > bitronix.tm.journal.disk.logPart2File = ./out/tx-logs/part2.btm
> > bitronix.tm.journal.disk.maxLogSize = 1
> > bitronix.tm.journal.disk.filterLogStatus = true
> >
> > bitronix.tm.timer.defaultTransactionTimeout = 60
> > bitronix.tm.timer.gracefulShutdownInterval = 60
> > bitronix.tm.timer.backgroundRecoveryIntervalSeconds = 60
> >
> > p.s. Sorry for my English :)
> > --
> > View this message in context:
> http://old.nabble.com/Error-enlisting-a-ConnectionJavaProxy-tp34761364p34761364.html
> > Sent from the Bitronix Transaction Manager mailing list archive at
> Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >    http://xircles.codehaus.org/manage_email
> >
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Ludovic Orban-2
Just one extra note if I may:

You'd better leave useTmJoin to its default value of true as it's not (directly) related to transaction interleaving, and without that setting you're going to deplete your connection pool very, very quickly. A bug in that optimization could lead the JDBC driver to try to interleave multiple transactions on a single connection, that would mean the rewritten XAPool has some serious concurrency issue...

Setting shareTransactionConnections to false is a good idea as this other optimization could also lead the JDBC driver to try to interleave multiple transactions too if a bug managed to sneak in.

Could you please test the 4 combinations of these two flags enabled or disabled and post your results here? That would certainly be helpful narrowing down the source of the problem.

Thanks,
Ludovic

On Thu, Dec 6, 2012 at 8:56 AM, Randll <[hidden email]> wrote:
What I did

removed forceBatchingEnabled
useTmJoin = false (was true)
shareTransactionConnections = false (was true)
updated PostgreSQL JDBC driver.
got latest sources

I will try to run the test today and report a results :)

Thanks a lot!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Brett Wooldridge-2
I've reviewed XAPool line-by-line and I didn't uncover any holes with respect to concurrency, but I did discover a major bug caused by a simple missing conditional.

The code to find an inaccessible resource that matches a XAStatefulHolder's gtrid had malformed logic like so:

private boolean containsXAResourceHolderMatchingGtrid(XAStatefulHolder xaStatefulHolder, final Uid currentTxGtrid) {

   for (XAResourceHolder xaResourceHolder : xaResourceHolders) {




On Thu, Dec 6, 2012 at 6:04 PM, Ludovic Orban <[hidden email]> wrote:
Just one extra note if I may:

You'd better leave useTmJoin to its default value of true as it's not (directly) related to transaction interleaving, and without that setting you're going to deplete your connection pool very, very quickly. A bug in that optimization could lead the JDBC driver to try to interleave multiple transactions on a single connection, that would mean the rewritten XAPool has some serious concurrency issue...

Setting shareTransactionConnections to false is a good idea as this other optimization could also lead the JDBC driver to try to interleave multiple transactions too if a bug managed to sneak in.

Could you please test the 4 combinations of these two flags enabled or disabled and post your results here? That would certainly be helpful narrowing down the source of the problem.

Thanks,
Ludovic


On Thu, Dec 6, 2012 at 8:56 AM, Randll <[hidden email]> wrote:
What I did

removed forceBatchingEnabled
useTmJoin = false (was true)
shareTransactionConnections = false (was true)
updated PostgreSQL JDBC driver.
got latest sources

I will try to run the test today and report a results :)

Thanks a lot!


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Brett Wooldridge-2
Opps hit send too soon... my containsXAResourceHolderMatchingGtrid() method had this incorrect logic:

private boolean containsXAResourceHolderMatchingGtrid(XAStatefulHolder xaStatefulHolder, final Uid currentTxGtrid) {
    boolean found = false;
    for (XAResourceHolder xaResourceHolder : xaResourceHolders) {
        // interate xaResourceHolder's XAResourceHolderStates and set 'found'
        return found;
    }
    return false;
}

Notice the 'return found' at the end of the loop?  That should have been:

   if (found) {
       return true;
   }

Basically, it was returning either 'true' or 'false' at the end of one iteration without ever getting to iterate over the rest of the xaResourceHolders.  Using shared connections actually masked this bug, because the logic in getConnectionHandle(boolean recycle) says:

if (recycle) {
   if (bean.getShareTransactionConnections()) {
       xaStatefulHolder = getSharedXAStatefulHolder();
   } else {
       xaStatefulHolder = getNotAccessible();
   }
}

I'll continue reviewing the code to see if I can spot anything else.

Brett



On Thu, Dec 6, 2012 at 9:53 PM, Brett Wooldridge <[hidden email]> wrote:
I've reviewed XAPool line-by-line and I didn't uncover any holes with respect to concurrency, but I did discover a major bug caused by a simple missing conditional.

The code to find an inaccessible resource that matches a XAStatefulHolder's gtrid had malformed logic like so:

private boolean containsXAResourceHolderMatchingGtrid(XAStatefulHolder xaStatefulHolder, final Uid currentTxGtrid) {

   for (XAResourceHolder xaResourceHolder : xaResourceHolders) {




On Thu, Dec 6, 2012 at 6:04 PM, Ludovic Orban <[hidden email]> wrote:
Just one extra note if I may:

You'd better leave useTmJoin to its default value of true as it's not (directly) related to transaction interleaving, and without that setting you're going to deplete your connection pool very, very quickly. A bug in that optimization could lead the JDBC driver to try to interleave multiple transactions on a single connection, that would mean the rewritten XAPool has some serious concurrency issue...

Setting shareTransactionConnections to false is a good idea as this other optimization could also lead the JDBC driver to try to interleave multiple transactions too if a bug managed to sneak in.

Could you please test the 4 combinations of these two flags enabled or disabled and post your results here? That would certainly be helpful narrowing down the source of the problem.

Thanks,
Ludovic


On Thu, Dec 6, 2012 at 8:56 AM, Randll <[hidden email]> wrote:
What I did

removed forceBatchingEnabled
useTmJoin = false (was true)
shareTransactionConnections = false (was true)
updated PostgreSQL JDBC driver.
got latest sources

I will try to run the test today and report a results :)

Thanks a lot!



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Error enlisting a ConnectionJavaProxy

Andrew Frolov
In reply to this post by Ludovic Orban-2
Ok.
I've run my test 3 times with
useTmJoin = true and shareTransactionConnections = false
It means 3 *2  hours of 5 jvms * 5 database threads in each jvm. I'v got no exceptions from bitronix. Looks like  ">=" fix from Brett helped!

I did not have much time to play with useTmJoin yet. I will probably do it next week :)

Ludovic Orban-2 wrote
Just one extra note if I may:

You'd better leave useTmJoin to its default value of true as it's not
(directly) related to transaction interleaving, and without that setting
you're going to deplete your connection pool very, very quickly. A bug in
that optimization could lead the JDBC driver to try to interleave multiple
transactions on a single connection, that would mean the rewritten XAPool
has some serious concurrency issue...

Setting shareTransactionConnections to false is a good idea as this other
optimization could also lead the JDBC driver to try to interleave multiple
transactions too if a bug managed to sneak in.

Could you please test the 4 combinations of these two flags enabled or
disabled and post your results here? That would certainly be helpful
narrowing down the source of the problem.

Thanks,
Ludovic

On Thu, Dec 6, 2012 at 8:56 AM, Randll <andrewfrolov@gmail.com> wrote:

> What I did
>
> removed forceBatchingEnabled
> useTmJoin = false (was true)
> shareTransactionConnections = false (was true)
> updated PostgreSQL JDBC driver.
> got latest sources
>
> I will try to run the test today and report a results :)
>
> Thanks a lot!
>
Loading...