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

Fix NPE in Binary.recomputeFile while migrating Audit

    XMLWordPrintable

    Details

      Description

      Fix the following NullPointerException gotten while migrating audits to ElasticSearch

      2018-10-18 19:14:07,060 ERROR [Nuxeo-Work-default-1:AuditMigration] [org.nuxeo.ecm.core.work.AbstractWork] Exception during work: ESAuditMigrationWork(, Progress(?%, 173400/337040), null)
      java.lang.NullPointerException
              at org.nuxeo.ecm.core.blob.binary.Binary.recomputeFile(Binary.java:128)
              at org.nuxeo.ecm.core.blob.binary.Binary.readObject(Binary.java:119)
              at sun.reflect.GeneratedMethodAccessor200.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
              at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2286)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2210)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
              at java.util.HashMap.readObject(HashMap.java:1409)
              at sun.reflect.GeneratedMethodAccessor189.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
              at java.util.HashMap.readObject(HashMap.java:1409)
              at sun.reflect.GeneratedMethodAccessor189.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
              at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:181)
              at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:211)
              at org.hibernate.type.SerializableToBlobType.fromBytes(SerializableToBlobType.java:69)
              at org.hibernate.type.SerializableToBlobType.get(SerializableToBlobType.java:61)
              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)
              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:89)
              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)
      2018-10-18 19:14:07,065 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: java.lang.NullPointerException
              at org.nuxeo.ecm.core.blob.binary.Binary.recomputeFile(Binary.java:128)
              at org.nuxeo.ecm.core.blob.binary.Binary.readObject(Binary.java:119)
              at sun.reflect.GeneratedMethodAccessor200.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
              at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2286)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2210)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
              at java.util.HashMap.readObject(HashMap.java:1409)
              at sun.reflect.GeneratedMethodAccessor189.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
              at java.util.HashMap.readObject(HashMap.java:1409)
              at sun.reflect.GeneratedMethodAccessor189.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2177)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2068)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1572)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
              at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:181)
              at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:211)
              at org.hibernate.type.SerializableToBlobType.fromBytes(SerializableToBlobType.java:69)
              at org.hibernate.type.SerializableToBlobType.get(SerializableToBlobType.java:61)
              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)
              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:89)
              at org.nuxeo.ecm.core.work.AbstractWork.runWorkWithTransaction(AbstractWork.java:435)
              at org.nuxeo.ecm.core.work.AbstractWork.run(AbstractWork.java:355)
              ... 4 more
      

      Expected outcome: Proper successful migration even when the binary file is missing

        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, 15 minutes
                2h 15m