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

Repository Replication: Deleting an asset stops the replicator with NullPointerException

    Details

    • Story Points:
      3
    • Sprint:
      NXRM Neo Sprint 32
    • Notability:
      2

      Description

      SYMPTOM:

      After setting up the Repository Replication with S3, deleting an asset causes ERROR with the following exception:

      18:31:20.583 ERROR c.s.n.replication.cli.ReplicatorCli - Error running replicator
      java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.toFile()" because the return value of "com.sonatype.nexus.replication.cli.rsync.RepositoryFileListing.getPath()" is null
      	at com.sonatype.nexus.replication.cli.aws.AwsReplicationApp.doReplicate(AwsReplicationApp.java:105)
      	at com.sonatype.nexus.replication.cli.ReplicationAppSupport.replicate(ReplicationAppSupport.java:74)
      	at com.sonatype.nexus.replication.cli.blobstore.s3.S3ReplicationBlobstore.replicateTo(S3ReplicationBlobstore.java:100)
      	at com.sonatype.nexus.replication.cli.ReplicatorCli.lambda$0(ReplicatorCli.java:121)
      	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
      	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
      	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
      	at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
      	at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754)
      	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
      	at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:686)
      	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159)
      	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:173)
      	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
      	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
      	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:765)
      	at com.sonatype.nexus.replication.cli.ReplicatorCli.handleSourceBlobstore(ReplicatorCli.java:117)
      	at com.sonatype.nexus.replication.cli.ReplicatorCli.replicate(ReplicatorCli.java:94)
      	at com.sonatype.nexus.replication.cli.ReplicatorCli.main(ReplicatorCli.java:65)
      

      REPRODUCE STEPS:

      1. Install one new NXRM 3.38.0 (do not need two instances for this test)
      2. Configure two S3 blob stores (can use one S3 bucket but with two different S3 Prefixes)
      3. Create two raw hosted repositories (eg: raw-s3-hosted and raw-s3-repl-hosted) with above blob stores
      4. Enable the Replication capability
      5. Create a new replication connection from "raw-s3-hosted" to "raw-s3-repl-hosted":
      6. Create a config.yml
        debug: 
            true
        sources: 
          - path: s3://apac-support-bucket/mytest_s3-test1/
            type: s3
            targets: 
              - path: s3://apac-support-bucket/mytest_s3-test2/
                type: s3
                repositoryName: raw-s3-repl-hosted
                connectionName: raw-s3-hosted_to_raw-s3-repl-hosted

        NOTE: please make sure the S3 paths end with "/" (NEXUS-29589)

      7. Run the replicator CLI
        java -jar ./nexus-3.38.0/nexus-3.38.0-01/replicator/nexus-replicator-cli-3.38.0-01.jar
      8. Upload some file into the "raw-s3-hosted"
      9. Wait for a while and confirm the repository replication is working by Browsing the "raw-s3-repl-hosted".
      10. Delete the uploaded asset from the source repository: "raw-s3-hosted"

      EXPECTED RESULT:

      Same as File type replication, deleting an asset should delete the asset from the target replication.

      ACTUAL RESULT:

      With the 3.38.0 replicator CLI jar, the process stops with java.lang.NullPointerException.
      The debug logging shows:

      15:23:16.932 DEBUG c.s.n.r.cli.aws.AwsReplicationApp - Executing aws sync to replicate content null
      

      Unlike RsyncReplicationApp, the "com.sonatype.nexus.replication.cli.aws.AwsReplicationApp#doReplicate" does not have the null check "if (repositoryFileListing.getPath() != null)"

        Attachments

          Activity

            People

            Assignee:
            jhill Joshua Hill
            Reporter:
            hosako Hajime Osako
            Last Updated By:
            Michael Martz Michael Martz
            Team:
            NXRM - Neo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Date of First Response:

                tigCommentSecurity.panel-title