Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-26130

Fix PSQLException Large Objects should not be handled in Auto-Commit mode in ESAuditMigrationWork

    XMLWordPrintable

    Details

      Description

      During a Audit Migration from Postgres to ElasticSearch, depending on the content of the audit, it is witnessed that the retrieval of audit logs from Postgres should be done within a transaction:

      2018-10-04 10:34:40,405 ERROR [Nuxeo-Work-default-1:AuditMigration] [org.nuxeo.ecm.core.work.AbstractWork] Exception during work: ESAuditMigrationWork(, Progress(?%, 160500/337030), null)
      org.hibernate.exception.GenericJDBCException: could not initialize a collection: [org.nuxeo.ecm.platform.audit.impl.LogEntryImpl.extendedInfos#3928947]
              at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
              at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
              at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
              at org.hibernate.loader.Loader.loadCollection(Loader.java:2026)
              at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:59)
              at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587)
              at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
              at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1744)
              at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:366)
              at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
              at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:131)
              at org.hibernate.collection.PersistentMap.size(PersistentMap.java:137)
              at org.nuxeo.ecm.platform.audit.service.LogEntryProvider.doPublish(LogEntryProvider.java:105)
              at org.nuxeo.ecm.platform.audit.service.LogEntryProvider.doPublishIfEntries(LogEntryProvider.java:92)
              at org.nuxeo.ecm.platform.audit.service.LogEntryProvider.nativeQuery(LogEntryProvider.java:245)
              at org.nuxeo.ecm.platform.audit.service.DefaultAuditBackend.lambda$nativeQuery$10(DefaultAuditBackend.java:180)
              at org.nuxeo.ecm.platform.audit.service.DefaultAuditBackend.lambda$apply$1(DefaultAuditBackend.java:134)
              at org.nuxeo.ecm.core.persistence.PersistenceProvider.run(PersistenceProvider.java:166)
              at org.nuxeo.ecm.platform.audit.service.DefaultAuditBackend.apply(DefaultAuditBackend.java:133)
              at org.nuxeo.ecm.platform.audit.service.DefaultAuditBackend.nativeQuery(DefaultAuditBackend.java:180)
              at org.nuxeo.elasticsearch.audit.ESAuditMigrationWork.work(ESAuditMigrationWork.java:84)
              at org.nuxeo.ecm.core.work.AbstractWork.runWorkWithTransaction(AbstractWork.java:435)
              at org.nuxeo.ecm.core.work.AbstractWork.run(AbstractWork.java:355)
              at org.nuxeo.ecm.core.work.WorkHolder.run(WorkHolder.java:57)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
      Caused by: org.postgresql.util.PSQLException: Les Large Objects ne devraient pas être utilisés en mode auto-commit.
              at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:262)
              at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:248)
              at org.postgresql.jdbc.AbstractBlobClob.getLo(AbstractBlobClob.java:272)
              at org.postgresql.jdbc.AbstractBlobClob.length(AbstractBlobClob.java:103)
              at org.hibernate.type.SerializableToBlobType.get(SerializableToBlobType.java:59)
              at org.hibernate.type.AbstractLobType.nullSafeGet(AbstractLobType.java:46)
              at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105)
              at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2114)
              at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1404)
              at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1332)
              at org.hibernate.loader.Loader.getRow(Loader.java:1230)
              at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:603)
              at org.hibernate.loader.Loader.doQuery(Loader.java:724)
              at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
              at org.hibernate.loader.Loader.loadCollection(Loader.java:2019)
              ... 23 more
      2018-10-04 10:34:40,412 ERROR [Nuxeo-Work-default-1] [org.nuxeo.ecm.core.work.WorkManagerImpl] Uncaught error on thread: Nuxeo-Work-default-1, current work might be lost, WorkManager metrics might be corrupted.
      org.nuxeo.ecm.core.api.NuxeoException: Work failed after 0 retries, class=class org.nuxeo.elasticsearch.audit.ESAuditMigrationWork id=AuditMigration category=ESAuditMigrationWork title=Audit migration worker
              at org.nuxeo.ecm.core.work.AbstractWork.workFailed(AbstractWork.java:410)
              at org.nuxeo.ecm.core.work.AbstractWork.run(AbstractWork.java:367)
              at org.nuxeo.ecm.core.work.WorkHolder.run(WorkHolder.java:57)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
      Caused by: org.hibernate.exception.GenericJDBCException: could not initialize a collection: [org.nuxeo.ecm.platform.audit.impl.LogEntryImpl.extendedInfos#3928947]
              at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
              at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
              at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
              at org.hibernate.loader.Loader.loadCollection(Loader.java:2026)
              at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:59)
              at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587)
              at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
              at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1744)
              at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:366)
              at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
              at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:131)
              at org.hibernate.collection.PersistentMap.size(PersistentMap.java:137)
              at org.nuxeo.ecm.platform.audit.service.LogEntryProvider.doPublish(LogEntryProvider.java:105)
              at org.nuxeo.ecm.platform.audit.service.LogEntryProvider.doPublishIfEntries(LogEntryProvider.java:92)
              at org.nuxeo.ecm.platform.audit.service.LogEntryProvider.nativeQuery(LogEntryProvider.java:245)
              at org.nuxeo.ecm.platform.audit.service.DefaultAuditBackend.lambda$nativeQuery$10(DefaultAuditBackend.java:180)
              at org.nuxeo.ecm.platform.audit.service.DefaultAuditBackend.lambda$apply$1(DefaultAuditBackend.java:134)
              at org.nuxeo.ecm.core.persistence.PersistenceProvider.run(PersistenceProvider.java:166)
              at org.nuxeo.ecm.platform.audit.service.DefaultAuditBackend.apply(DefaultAuditBackend.java:133)
              at org.nuxeo.ecm.platform.audit.service.DefaultAuditBackend.nativeQuery(DefaultAuditBackend.java:180)
              at org.nuxeo.elasticsearch.audit.ESAuditMigrationWork.work(ESAuditMigrationWork.java:84)
              at org.nuxeo.ecm.core.work.AbstractWork.runWorkWithTransaction(AbstractWork.java:435)
              at org.nuxeo.ecm.core.work.AbstractWork.run(AbstractWork.java:355)
              ... 4 more
      Caused by: org.postgresql.util.PSQLException: Les Large Objects ne devraient pas être utilisés en mode auto-commit.
              at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:262)
              at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:248)
              at org.postgresql.jdbc.AbstractBlobClob.getLo(AbstractBlobClob.java:272)
              at org.postgresql.jdbc.AbstractBlobClob.length(AbstractBlobClob.java:103)
              at org.hibernate.type.SerializableToBlobType.get(SerializableToBlobType.java:59)
              at org.hibernate.type.AbstractLobType.nullSafeGet(AbstractLobType.java:46)
              at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105)
              at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2114)
              at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1404)
              at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1332)
              at org.hibernate.loader.Loader.getRow(Loader.java:1230)
              at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:603)
              at org.hibernate.loader.Loader.doQuery(Loader.java:724)
              at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
              at org.hibernate.loader.Loader.loadCollection(Loader.java:2019)
              ... 23 more
      

      Expected outcome: proper behavior of the migration even if the audit contains large objects.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 45 minutes
                2h 45m