Uploaded image for project: 'Hibernate ORM'
  1. HHH-12920

AbstractCachedDomainDataAccess.clearCache() throws MissingFormatArgumentException at DEBUG level

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.3.1, 5.3.2, 5.3.3, 5.3.4, 5.3.5
    • Fix Version/s: 5.4.0.CR1, 5.3.7
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • backPortable:
      Backport?
    • Last commented by a user?:
      true
    • Sprint:

      Description

      While running my application with logging level set to DEBUG, the application throws java.util.MissingFormatArgumentException when org.hibernate.action.internal.BulkOperationCleanupAction was trying to clean up.

      The stack trace (see at the bottom) reveals a bug in a class named AbstractCachedDomainDataAccess, which was introduced since 5.3. Please refer to the source code here.

      It's obvious that parameter was missed in the statement, and that eventually caused below invocation (Slf4jLocationAwareLogger.doLogf in my case as I'm using Slf4j.

      Root cause
          // Eventually that will call String.format at runtime...
          String.format( "Clearing cache data map [region=`%s`]" );
      

      I can change my logging settings to avoid this issue. However, it would still be great to fix it in case checking DEBUG output is required.

      Stacktrace
      org.hibernate.AssertionFailure: Exception releasing cache locks
      	at org.hibernate.engine.spi.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:990)
      	at org.hibernate.engine.spi.ActionQueue.afterTransactionCompletion(ActionQueue.java:513)
      	at org.hibernate.internal.SessionImpl.afterTransactionCompletion(SessionImpl.java:2501)
      	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.afterTransactionCompletion(JdbcCoordinatorImpl.java:479)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.afterCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:198)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$400(JdbcResourceLocalTransactionCoordinatorImpl.java:39)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:273)
      	at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:98)
      	at org.springframework.orm.hibernate5.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:582)
        // ... omit ...
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: java.util.MissingFormatArgumentException: Format specifier '%s'
      	at java.util.Formatter.format(Formatter.java:2519)
      	at java.util.Formatter.format(Formatter.java:2455)
      	at java.lang.String.format(String.java:2940)
      	at org.jboss.logging.Slf4jLocationAwareLogger.doLogf(Slf4jLocationAwareLogger.java:81)
      	at org.jboss.logging.Logger.debugf(Logger.java:701)
      	at org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess.clearCache(AbstractCachedDomainDataAccess.java:43)
      	at org.hibernate.cache.spi.support.AbstractEntityDataAccess.unlockRegion(AbstractEntityDataAccess.java:60)
      	at org.hibernate.action.internal.BulkOperationCleanupAction$EntityCleanup.release(BulkOperationCleanupAction.java:226)
      	at org.hibernate.action.internal.BulkOperationCleanupAction$EntityCleanup.access$300(BulkOperationCleanupAction.java:213)
      	at org.hibernate.action.internal.BulkOperationCleanupAction$1.doAfterTransactionCompletion(BulkOperationCleanupAction.java:185)
      	at org.hibernate.engine.spi.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:983)
      	... 66 more
      

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: