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

PublishMavenIndexTask fails to republish maven Index if hosted Maven repository has write policy of ALLOW_ONCE

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.8.0
    • Fix Version/s: 3.13.0
    • Component/s: Maven, Scheduled Tasks
    • Labels:
    • Environment:
      CentOS 6.9, java version "1.8.0_162"
      Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
    • Story Points:
      1

      Description

      On locally hosted repositories, Maven indexes are not published for the second running of the task for those repositories marked as Release.

      I expected that if the repositories marked as release had not changed, then no update to the index would be attempted and the logs would indicate that. Instead a error occurred stating the following:

      org.sonatype.nexus.repository.IllegalOperationException: Repository does not allow updating assets: releases

      was present in the task log, and the task manager showed that the task had failed with an error.


      The releases repository has a writePolicy of "ALLOW_ONCE". That policy is intended to prevent republishing/overwriting the same artifact into the repository.

      It is not intended to prevent the publish indexes task from running repeatedly and updating.

       

      {
      "@type": "d",
      "@rid": "#24:15",
      "@version": 4,
      "@class": "repository",
      "recipe_name": "maven2-hosted",
      "repository_name": "releases",
      "online": true,
      "attributes": {
      "maven": {
      "versionPolicy": "RELEASE",
      "layoutPolicy": "PERMISSIVE"
      },
      "storage": {
      "strictContentTypeValidation": false,
      "writePolicy": "ALLOW_ONCE",
      "blobStoreName": "default"
      }
      }
      }
      2018-02-21 01:00:05,807-0800 ERROR [quartz-4-thread-18]  *SYSTEM org.sonatype.nexus.repository.maven.tasks.PublishMavenIndexTask - Failed to run task 'Publish Maven indexes of releases'
      org.sonatype.goodies.common.MultipleFailures$MultipleFailuresException: Failed to run task 'Publish Maven indexes of releases'; 1 failure
      	at org.sonatype.goodies.common.MultipleFailures.maybePropagate(MultipleFailures.java:95)
      	at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:89)
      	at org.sonatype.nexus.scheduling.TaskSupport.call(TaskSupport.java:93)
      	at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.doExecute(QuartzTaskJob.java:145)
      	at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.execute(QuartzTaskJob.java:108)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      	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.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	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)
      	Suppressed: org.sonatype.nexus.repository.IllegalOperationException: Repository does not allow updating assets: releases
      		at org.sonatype.nexus.repository.storage.StorageTxImpl.maybeDeleteBlob(StorageTxImpl.java:790)
      		at org.sonatype.nexus.repository.storage.StorageTxImpl.attachBlob(StorageTxImpl.java:688)
      		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      		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:270)
      		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.$Proxy199.attachBlob(Unknown Source)
      		at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.putAssetPayload(MavenFacetImpl.java:432)
      		at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.putFile(MavenFacetImpl.java:419)
      		at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.doPutAssetBlob(MavenFacetImpl.java:299)
      		at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.doPut(MavenFacetImpl.java:249)
      		at org.sonatype.nexus.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:45)
      		at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.put(MavenFacetImpl.java:201)
      		at org.sonatype.nexus.repository.maven.internal.MavenIndexPublisher$Maven2WritableResource.close(MavenIndexPublisher.java:462)
      		at org.apache.maven.index.reader.IndexWriter.writeChunk(IndexWriter.java:161)
      		at org.sonatype.nexus.repository.maven.internal.MavenIndexPublisher.lambda$0(MavenIndexPublisher.java:216)
      		at org.sonatype.nexus.transaction.OperationPoint.proceed(OperationPoint.java:64)
      		at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:56)
      		at org.sonatype.nexus.transaction.Operations.transactional(Operations.java:200)
      		at org.sonatype.nexus.transaction.Operations.call(Operations.java:146)
      		at org.sonatype.nexus.repository.maven.internal.MavenIndexPublisher.publishHostedIndex(MavenIndexPublisher.java:211)
      		at org.sonatype.nexus.repository.maven.internal.hosted.MavenHostedIndexFacet.publishIndex(MavenHostedIndexFacet.java:38)
      		at org.sonatype.nexus.repository.maven.tasks.PublishMavenIndexTask.execute(PublishMavenIndexTask.java:37)
      		at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:73)
      		... 12 common frames omitted
      		Suppressed: org.sonatype.nexus.repository.IllegalOperationException: Repository does not allow updating assets: releases
      			at org.sonatype.nexus.repository.storage.StorageTxImpl.maybeDeleteBlob(StorageTxImpl.java:790)
      			at org.sonatype.nexus.repository.storage.StorageTxImpl.attachBlob(StorageTxImpl.java:688)
      			at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      			at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      			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:270)
      			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.$Proxy199.attachBlob(Unknown Source)
      			at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.putAssetPayload(MavenFacetImpl.java:432)
      			at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.putFile(MavenFacetImpl.java:419)
      			at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.doPutAssetBlob(MavenFacetImpl.java:299)
      			at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.doPut(MavenFacetImpl.java:249)
      			at org.sonatype.nexus.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:45)
      			at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.put(MavenFacetImpl.java:201)
      			at org.sonatype.nexus.repository.maven.internal.MavenIndexPublisher$Maven2WritableResource.close(MavenIndexPublisher.java:462)
      			at org.apache.maven.index.reader.Utils.storeProperties(Utils.java:115)
      			at org.apache.maven.index.reader.IndexWriter.close(IndexWriter.java:177)
      			at org.sonatype.nexus.repository.maven.internal.MavenIndexPublisher.lambda$0(MavenIndexPublisher.java:225)
      			... 20 common frames omitted
      
      

      Also, when the task fails in some circumstances it can leave blob references in the database that are deleted from the blob store. Future runs of the task may throw MissingBlobException - see NEXUS-16560

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jbryan Jeremy Bryan
              Reporter:
              mdeggers Mark Eggers
              Last Updated By:
              Peter Lynch Peter Lynch
              Team:
              Nexus - Core
              Votes:
              3 Vote for this issue
              Watchers:
              13 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  tigCommentSecurity.panel-title