BTM
  1. BTM
  2. BTM-34

IllegalArgumentException and MBean exceptions on constraint violation

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.2
    • Fix Version/s: 1.3.3
    • Labels:
      None
    • Environment:
      Windows XP, MySQL, Hibernate, Spring
    • Number of attachments :
      2

      Description

      When I hit a DB constraint violation, I get the expected constraint violation exception and rollback. But in addition, BTM also logs some worrisome-looking exceptions concerning the connection pool and the management MBean. In case this might be serious, I am logging this issue. I did a run with BTM's debug logging enabled and am attaching the log. The error occurs at the end of the log.

      16:01:12,546 WARN BitronixTransaction: Synchronization.afterCompletion() call failed for a DeferredReleaseSynchronization of a JdbcPooledConnection from datasource makanasolutions DB in state IN_POOL wrapping a LrcXAConnection
      java.lang.IllegalArgumentException: cannot switch state from IN_POOL to IN_POOL
      at bitronix.tm.resource.common.AbstractXAStatefulHolder.setState(AbstractXAStatefulHolder.java:34)
      at bitronix.tm.resource.common.DeferredReleaseSynchronization.afterCompletion(DeferredReleaseSynchronization.java:30)
      at bitronix.tm.BitronixTransaction.fireAfterCompletionEvent(BitronixTransaction.java:382)
      at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:188)
      at bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:96)
      ...

      16:01:12,562 WARN ManagementRegistrar: cannot unregister object with name bitronix.tm:type=Transaction,Gtrid=4B6168756E612D62746D0000011D9CCEB756000000D6
      bitronix.tm.internal.BitronixRuntimeException: cannot callunregisterMBean
      at bitronix.tm.utils.ManagementRegistrar.mbeanServerCall(ManagementRegistrar.java:95)
      at bitronix.tm.utils.ManagementRegistrar.unregister(ManagementRegistrar.java:74)
      at bitronix.tm.BitronixTransaction.fireAfterCompletionEvent(BitronixTransaction.java:388)
      at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:188)
      at bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:96)
      ...

        Activity

        Hide
        Ludovic Orban added a comment -

        It looks like you're running many threads in parallel according to the log file you attached but I cannot make sure this assumption is actually true.

        If that's the case, it would be very useful to include the thread's name in the log file as well and to know if the problem can be reproduced in a single-threaded environment and if so, attach that log as well.

        Show
        Ludovic Orban added a comment - It looks like you're running many threads in parallel according to the log file you attached but I cannot make sure this assumption is actually true. If that's the case, it would be very useful to include the thread's name in the log file as well and to know if the problem can be reproduced in a single-threaded environment and if so, attach that log as well.
        Hide
        Christopher Wong added a comment -

        This is primarily a single-threaded operation. I have attached the same operation in a log with thread names (immediately after the priority column).

        Show
        Christopher Wong added a comment - This is primarily a single-threaded operation. I have attached the same operation in a log with thread names (immediately after the priority column).
        Hide
        Ludovic Orban added a comment - - edited

        Good spot ! There actually is a bug in the Synchronizations execution code. If a transaction is marked for rollback only, the Synchronization.afterCompletion() will be executed twice which explains why BTM complains the connection is already back in the pool and the JMX name does not exist anymore.

        It's an easy fix so I've build a snapshot release that should solve the problem. You can download the distribution from here: http://snapshots.dist.codehaus.org/btm/btm-dist-1.3.3-20081114.zip or the BTM JAR from here: http://snapshots.repository.codehaus.org/org/codehaus/btm/btm/1.3.3-20081114/btm-1.3.3-20081114.jar

        Could you please test this build and report back the outcome ?

        Thanks.

        Show
        Ludovic Orban added a comment - - edited Good spot ! There actually is a bug in the Synchronizations execution code. If a transaction is marked for rollback only, the Synchronization.afterCompletion() will be executed twice which explains why BTM complains the connection is already back in the pool and the JMX name does not exist anymore. It's an easy fix so I've build a snapshot release that should solve the problem. You can download the distribution from here: http://snapshots.dist.codehaus.org/btm/btm-dist-1.3.3-20081114.zip or the BTM JAR from here: http://snapshots.repository.codehaus.org/org/codehaus/btm/btm/1.3.3-20081114/btm-1.3.3-20081114.jar Could you please test this build and report back the outcome ? Thanks.
        Hide
        Christopher Wong added a comment -

        I am pleased to report that your fix works. No additional exceptions are logged beyond the DB constraint violation exception (which SHOULD be logged). My thanks for your amazing responsiveness.

        Show
        Christopher Wong added a comment - I am pleased to report that your fix works. No additional exceptions are logged beyond the DB constraint violation exception (which SHOULD be logged). My thanks for your amazing responsiveness.
        Hide
        Ludovic Orban added a comment -

        Fixed in trunk, tested working by reporter and unit test added.

        Show
        Ludovic Orban added a comment - Fixed in trunk, tested working by reporter and unit test added.

          People

          • Assignee:
            Ludovic Orban
            Reporter:
            Christopher Wong
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: