Uploaded image for project: 'Grouper'
  1. Grouper
  2. GRP-446

postgres transaction rollback fails unless connection.rollback

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: HEAD
    • Fix Version/s: 1.6.0
    • Component/s: API
    • Labels:
      None

      Description

      In postgres, this fails unless a postgres connection.rollback is called instead of transaction.rollback. Maybe we need to switch to save point in the transaction

      /**

      • catch and handle an exception while working with hibernate session. Dont call this if you dont know what you are doing.
      • @param hibernateSession
      • @param e
      • @throws GrouperDAOException
        */
        public static void _internal_hibernateSessionCatch(HibernateSession hibernateSession, Throwable e) throws GrouperDAOException {
        // maybe we didnt rollback. if new session, and exception, and not
        // committed or rolledback,
        // then rollback.
        //CH 20080220: should we always rollback? or if not rollback, flush and clear?
        if (hibernateSession != null && hibernateSession.isNewHibernateSession() && !hibernateSession.isReadonly())
        Unknown macro: { if (hibernateSession.immediateTransaction.isActive()) { hibernateSession.immediateTransaction.rollback(); } }

      11) testRemoveBadFlatAttributeDefsWithUpdates(edu.internet2.middleware.grouper.misc.SyncFlatTablesTest)edu.internet2.middleware.grouper.internal.dao.GrouperDAOException: Problem in HibernateSession: HibernateSession: isNew: false, isReadonly: false, grouperTransactionType: READ_WRITE_NEW,
      Exception in uniqueResult: (class edu.internet2.middleware.grouper.attr.AttributeDef), ByHqlStatic, query: 'from AttributeDef where id = :theId', cacheable: true, cacheRegion: edu.internet2.middleware.grouper.internal.dao.hib3.Hib3AttributeDefDAO.FindById, tx type: null, tx type: nullBind var[0]: 'Param (class java.lang.String): 'theId'->'4b9a8dd952cf40b8ab52b3dcbe2c3af9', ,
      Problem in HibernateSession: HibernateSession: isNew: true, isReadonly: false, grouperTransactionType: READ_WRITE_NEW
      at edu.internet2.middleware.grouper.hibernate.HibernateSession._internal_hibernateSessionCatch(HibernateSession.java:382)
      at edu.internet2.middleware.grouper.hibernate.HibernateSession.callbackHibernateSession(HibernateSession.java:468)
      at edu.internet2.middleware.grouper.hibernate.ByHqlStatic.uniqueResult(ByHqlStatic.java:297)
      at edu.internet2.middleware.grouper.internal.dao.hib3.Hib3AttributeDefDAO.findById(Hib3AttributeDefDAO.java:67)
      at edu.internet2.middleware.grouper.changeLog.ChangeLogTempToEntity.processAttributeDefAdd(ChangeLogTempToEntity.java:256)
      at edu.internet2.middleware.grouper.changeLog.ChangeLogTempToEntity.access$400(ChangeLogTempToEntity.java:45)
      at edu.internet2.middleware.grouper.changeLog.ChangeLogTempToEntity$1.callback(ChangeLogTempToEntity.java:98)
      at edu.internet2.middleware.grouper.hibernate.HibernateSession.callbackHibernateSession(HibernateSession.java:458)
      at edu.internet2.middleware.grouper.changeLog.ChangeLogTempToEntity.convertRecords(ChangeLogTempToEntity.java:83)
      at edu.internet2.middleware.grouper.changeLog.ChangeLogTempToEntity.convertRecords(ChangeLogTempToEntity.java:53)
      at edu.internet2.middleware.grouper.misc.SyncFlatTablesTest.testRemoveBadFlatAttributeDefsWithUpdates(SyncFlatTablesTest.java:1158)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at edu.internet2.middleware.grouper.AllTests.main(AllTests.java:136)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at edu.internet2.middleware.grouper.app.gsh.GrouperShell.handleSpecialCase(GrouperShell.java:188)
      at edu.internet2.middleware.grouper.app.gsh.GrouperShell.main(GrouperShell.java:128)
      at edu.internet2.middleware.grouper.app.gsh.GrouperShellWrapper.main(GrouperShellWrapper.java:16)
      Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.loader.Loader.doList(Loader.java:2216)
      at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2136)
      at org.hibernate.loader.Loader.list(Loader.java:2096)
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
      at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
      at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
      at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
      at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)
      at edu.internet2.middleware.grouper.hibernate.ByHql.uniqueResult(ByHql.java:242)
      at edu.internet2.middleware.grouper.hibernate.ByHqlStatic$1.callback(ByHqlStatic.java:306)
      at edu.internet2.middleware.grouper.hibernate.HibernateSession.callbackHibernateSession(HibernateSession.java:458)
      ... 36 more
      Caused by: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
      at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
      at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
      at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
      at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
      at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
      at org.hibernate.loader.Loader.doQuery(Loader.java:674)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
      at org.hibernate.loader.Loader.doList(Loader.java:2213)

        Smart Checklist

          Attachments

            Activity

              People

              Assignee:
              chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
              Reporter:
              chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: