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

Prevent transaction timeouts during computeAndReplaceDigest

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2021.0
    • Fix Version/s: 2021.55, 2023.13
    • Component/s: S3
    • Backlog priority:
      800
    • Sprint:
      nxplatform #112, nxplatform #113
    • Story Points:
      5

      Description

      When blob digests are computed asynchronously (with the nuxeo.core.blobstore.digestAsync=true option), it can take a long time to process a large blob (6h for 1TB).
      The ComputeDigestWork should have a customizable transaction timeout with a long default.

      The option should be called:
      nuxeo.core.blobstore.digestAsync.transaction.timeout.seconds

      The default value 8h.

      -------
      Previous description:

      When uploading a 1TB+ document to S3, a timeout can occur as the result of both digest computation and S3 move occupying the vast majority of the process - even after setting a large timeout and setting nuxeo.core.blobstore.digestAsync=true.

      computeAndReplaceDigest comprises the three following main steps:

      1. digest = computeDigest(blobStore); - calculating the md5 digest of the binary after downloading the blob to the filesystem.
      2. newKey = blobStore.copyOrMoveBlob(digest, blobStore, key, false); - S3 move wherein object key is set to the calculated digest in step 1.
      3. replaceDigestAllRepositories(); - DB operation to update all respective documents with the calculated digest.

      For very large Documents, steps 1 and 2 taking a long time can cause the transaction to time out during step 3 where the following error can be observed. This should be prevented by having steps 1 and/or 2 performed in a separate transaction :

      Caused by: org.nuxeo.runtime.transaction.TransactionRuntimeException: Transaction has timed out: Tx started: 1710245843373, timeout: 1710263843373 (duration 18000s), current: 1710268574364
       at org.nuxeo.runtime.transaction.TransactionHelper.checkTransactionTimeout(TransactionHelper.java:277) ~[nuxeo-runtime-jtajca-2021.36.9.jar:?]
       at org.nuxeo.ecm.core.repository.RepositoryService.getSession(RepositoryService.java:301) ~[nuxeo-core-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.api.local.LocalSession.getSession(LocalSession.java:65) ~[nuxeo-core-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.api.AbstractSession.queryAndFetch(AbstractSession.java:1365) ~[nuxeo-core-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.api.AbstractSession.queryAndFetch(AbstractSession.java:1345) ~[nuxeo-core-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.blob.ComputeDigestHelper.replaceDigest(ComputeDigestHelper.java:157) ~[nuxeo-core-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.blob.ComputeDigestHelper.lambda$replaceDigest$0(ComputeDigestHelper.java:145) ~[nuxeo-core-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.api.CoreInstance$3.run(CoreInstance.java:268) ~[nuxeo-core-api-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.api.UnrestrictedSessionRunner.runUnrestricted(UnrestrictedSessionRunner.java:123) ~[nuxeo-core-api-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.api.CoreInstance.doPrivileged(CoreInstance.java:270) ~[nuxeo-core-api-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.blob.ComputeDigestHelper.lambda$replaceDigest$1(ComputeDigestHelper.java:145) ~[nuxeo-core-2021.47.4.jar:?]
       at org.nuxeo.runtime.transaction.TransactionHelper.lambda$runInTransaction$4(TransactionHelper.java:642) ~[nuxeo-runtime-jtajca-2021.36.9.jar:?]
       at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:675) ~[nuxeo-runtime-jtajca-2021.36.9.jar:?]
       at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:642) ~[nuxeo-runtime-jtajca-2021.36.9.jar:?]
       at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:630) ~[nuxeo-runtime-jtajca-2021.36.9.jar:?]
       at org.nuxeo.ecm.core.blob.ComputeDigestHelper.replaceDigest(ComputeDigestHelper.java:144) ~[nuxeo-core-2021.47.4.jar:?]
       at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?]
       at org.nuxeo.ecm.core.blob.ComputeDigestHelper.replaceDigestAllRepositories(ComputeDigestHelper.java:139) ~[nuxeo-core-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.blob.ComputeDigestHelper.computeAndReplaceDigest(ComputeDigestHelper.java:94) ~[nuxeo-core-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.blob.ComputeDigestWork.work(ComputeDigestWork.java:55) ~[nuxeo-core-2021.47.4.jar:?]
       at org.nuxeo.ecm.core.work.AbstractWork.runWorkWithTransaction(AbstractWork.java:524) ~[nuxeo-core-event-2021.45.8.jar:?]
       at org.nuxeo.ecm.core.work.AbstractWork.run(AbstractWork.java:387) ~[nuxeo-core-event-2021.45.8.jar:?] ... 17 more 
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: