Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-23827

PACKAGES.gz cannot be updated if R repo doesn't allow reupload

    Details

      Description

      Discovered on Nexus OSS 3.21.2-03 in Docker on Kubernetes, deployed using Helm chart.

      We were using the R repository with a 'Disable redeploy' deployment policy.

      The PACKAGES.gz cannot be updated, which functions as an index on the repository. I noticed this by checking the 'Blob updated' field on the PACKAGES.gz, it wasn't updated when I uploaded a new package.

      I assume the same error occurs when the deployment policy is set to 'Read Only', but I haven't check this.

      Workaround

      Workaround was to set the deployment policy to 'Allow redeploy' for now.

      Details

      In the logs of Nexus I noticed the PACKAGES.gz could not be updated:

      2020-05-07 07:35:02,858+0000 INFO [event-6-thread-6306] <instance> org.sonatype.nexus.repository.r.internal.hosted.RPackagesBuilderFacetImpl - Rebuilding R PACKAGES.gz metadata for repository <repository>
      2020-05-07 07:35:02,866+0000 ERROR [event-6-thread-6306] <instance> com.google.common.eventbus.EventBus.nexus.async - Could not dispatch event org.sonatype.nexus.repository.r.internal.hosted.RMetadataInvalidationEvent@3c04a336 to subscriber org.sonatype.nexus.repository.r.internal.hosted.RPackagesBuilderFacetImpl$$EnhancerByGuice$$1494c12b@bd80d41 method [public void org.sonatype.nexus.repository.r.internal.hosted.RPackagesBuilderFacetImpl.on(org.sonatype.nexus.repository.r.internal.hosted.RMetadataInvalidationEvent)]
      org.sonatype.nexus.repository.IllegalOperationException: Repository does not allow updating assets: <repository>
       at org.sonatype.nexus.repository.storage.StorageTxImpl.setBlob(StorageTxImpl.java:861)
       at sun.reflect.GeneratedMethodAccessor468.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at org.sonatype.nexus.common.stateguard.SimpleMethodInvocation.proceed(SimpleMethodInvocation.java:53)
       at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
       at org.sonatype.nexus.common.stateguard.StateGuard$GuardImpl.run(StateGuard.java:272)
       at org.sonatype.nexus.common.stateguard.GuardedInterceptor.invoke(GuardedInterceptor.java:53)
       at org.sonatype.nexus.common.stateguard.StateGuardAspect$1.invoke(StateGuardAspect.java:63)
       at com.sun.proxy.$Proxy210.setBlob(Unknown Source)
       at org.sonatype.nexus.repository.r.internal.util.RFacetUtils.saveAsset(RFacetUtils.java:155)
       at org.sonatype.nexus.repository.r.internal.hosted.RHostedFacetImpl.doPutPackagesGz(RHostedFacetImpl.java:129)
       at org.sonatype.nexus.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:49)
       at org.sonatype.nexus.repository.r.internal.hosted.RHostedFacetImpl.buildAndPutPackagesGz(RHostedFacetImpl.java:119)
       at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:57)
       at org.sonatype.nexus.transaction.TransactionInterceptor.proceedWithTransaction(TransactionInterceptor.java:66)
       at org.sonatype.nexus.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:55)
       at org.sonatype.nexus.repository.r.internal.hosted.RPackagesBuilderFacetImpl.on(RPackagesBuilderFacetImpl.java:134)
       at sun.reflect.GeneratedMethodAccessor909.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:87)
       at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:144)
       at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:72)
       at org.sonatype.nexus.thread.internal.MDCAwareRunnable.run(MDCAwareRunnable.java:40)
       at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120)
       at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108)
       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)

      And in R, when trying to install, this will either trigger a generic error in case a new package was uploaded and is not yet in PACKAGES.gz:

      package ‘<new package>’ is not available (for R version <your R version>) 

      In case only a new package version was uploaded, the older version will probably be downloaded, as the newer version in PACKAGES.gz. But I haven't tested this.

      Fix

      I assume the org.sonatype.nexus.repository.r.internal.hosted.RPackagesBuilderFacetImpl should be able to update PACKAGES.gz regardless of the deployment policy. Either by excluding the policy on the PACKAGES.gz or by providing additional priviledges on the RPackagesBuilderFacetImpl. I say this without knowing the intricacies of source code.

       

      P.S. Thanks for releasing Nexus as Free Software and now integrating R in the core 👏♥

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aornatovskyy Anatoliy Ornatovskyy
              Reporter:
              nicorikken Nico
              Last Updated By:
              Joe Tom Joe Tom
              Team:
              NXRM - Trinity
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  tigCommentSecurity.panel-title