Deadlock detected while waiting for resource when applying multiple updates to the same JON alert template definition in a short period of time

Solution Verified - Updated -

Issue

  • I consistently get the following error:

    Alert definition update failed. This occurred because the server is taking a long time to complete this request. Please be aware that the server may still be processing your request and it may complete shortly. You can check the server logs to see if any abnormal errors occurred.
    
  • Server logs:

    WARN  [org.hibernate.util.JDBCExceptionReporter] SQL Error: 60, SQLState: 61000
    ERROR [org.hibernate.util.JDBCExceptionReporter] ORA-00060: deadlock detected while waiting for resource
    
  • Oracle deadlock (ORA-00060) occurred

  • Two sessions deadlocked on the statement

    delete from RHQ_CONFIG where id=:1
    
  • server.log contains:

    ERROR [org.hibernate.engine.jdbc.batch.internal.BatchingBatch] (http-/0.0.0.0:8443-101) HHH000315: Exception executing batch [could not perform addBatch]
    WARN  [com.arjuna.ats.arjuna] (http-/0.0.0.0:8443-101) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffff04800219:-382f3701:532bee85:2ebed353, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@2f477481 >: javax.persistence.PersistenceException: org.hibernate.exception.LockAcquisitionException: could not perform addBatch
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) [hibernate-entitymanager-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310) [hibernate-entitymanager-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
        ...
        at org.rhq.enterprise.server.alert.AlertTemplateManagerLocal$$$view15.updateAlertTemplate(Unknown Source) [rhq-server.jar:4.9.0.JON320GA]
        at org.rhq.coregui.server.gwt.AlertTemplateGWTServiceImpl.updateAlertTemplate(AlertTemplateGWTServiceImpl.java:47)
        ...
    Caused by: org.hibernate.exception.LockAcquisitionException: could not perform addBatch
        at org.hibernate.dialect.Oracle8iDialect$2.convert(Oracle8iDialect.java:449) [hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
        at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) [hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
        ...
    Caused by: java.sql.BatchUpdateException: ORA-00060: deadlock detected while waiting for resource
    
        at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10345) [ojdbc6-11.2.0.3.0.jar:11.2.0.3.0]
        at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:230) [ojdbc6-11.2.0.3.0.jar:11.2.0.3.0]
        at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.executeBatch(CachedPreparedStatement.java:708)
        at org.jboss.jca.adapters.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:1077)
        at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:110) [hibernate-core-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
        ... 180 more
    
  • Every time I update an alert definition template, I get the following in a pop-up:

    Alert definition update failed. This occurred because the server is taking a long time to complete this request. Please be aware that the server may still be processing your request and it may complete shortly. You can check the server logs to see if any abnormal errors occurred.
    

Environment

  • Red Hat JBoss Operations Network (ON) 3.1, 3.2
  • Updating the same alert template twice within a short period of time

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content