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

'Export Repository Assets' task will fail during validation/pre-requisite checks if the target file path is ~8 EB in size.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.35.0
    • Fix Version/s: None
    • Component/s: import-export
    • Labels:
    • Notability:
      3

      Description

      Problem
      'Export Repository Assets' task will fail during validation/pre-requisite checks if the target file path is ~8 Exabyte in size.

      Description
      The Export Repository task runs a pre-requisite check which verifies there is enough free space to export the whole repository.

      It uses com.sonatype.nexus.exportimport.internal.exporttask.DiskService()

      public long availableBytes(final File file) throws IOException {
          return Files.getFileStore(file.toPath()).getUsableSpace();
        }

      When running getUsableSpace() on the target file-path, it is treating the returned values as signed Longs and in turn reports negative numbers and in the case of an 8 Exabyte disk, will report a negative number (-9223372036854776000.00 B available).

      2021-10-19 10:31:54,025+0100 INFO  [quartz-32-thread-20]   *SYSTEM com.sonatype.nexus.exportimport.internal.exporttask.RepositoryExportTask -  Description: Repository - Export assets
      2021-10-19 10:31:54,026+0100 INFO  [quartz-32-thread-20]   *SYSTEM com.sonatype.nexus.exportimport.internal.exporttask.orient.OrientRepositoryExportService - Checking prerequisites for export of repository <repository-name> into /obfuscated/path/
      2021-10-19 10:31:54,498+0100 ERROR [quartz-32-thread-20]   *SYSTEM com.sonatype.nexus.exportimport.internal.exporttask.orient.OrientDiskSpaceExportValidation - Destination /obfuscated/path/ doesn't have enough space to export content from repository <repository-name> (-9223372036854776000.00 B available, 2.21 GB required)
      2021-10-19 10:31:54,498+0100 ERROR [quartz-32-thread-20]  *SYSTEM com.sonatype.nexus.exportimport.internal.exporttask.RepositoryExportTask - Failed to run task 'Repository - Export assets' on repository '<repository-name>'
      java.lang.RuntimeException: Export of repository <repository-name> into /obfuscated/path/ failed
      	at com.sonatype.nexus.exportimport.internal.exporttask.RepositoryExportServiceSupport.doExport(RepositoryExportServiceSupport.java:103)
      	at com.sonatype.nexus.exportimport.internal.exporttask.RepositoryExportTask.execute(RepositoryExportTask.java:58)
      	at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:79)
      	at org.sonatype.nexus.scheduling.TaskSupport.call(TaskSupport.java:100)
      	at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.doExecute(QuartzTaskJob.java:143)
      	at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.execute(QuartzTaskJob.java:106)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      	at org.sonatype.nexus.quartz.internal.QuartzThreadPool.lambda$0(QuartzThreadPool.java:145)
      	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)
      Caused by: java.io.IOException: Prerequisites check failed.
      	at com.sonatype.nexus.exportimport.internal.exporttask.RepositoryExportServiceSupport.doExport(RepositoryExportServiceSupport.java:97)
      	... 15 common frames omitted

      This looks to be caused by/related to JDK-8162520, fixed from JDK14

      Possible fix (for now)
      As per this PR, might it be possible to use the same approach with DiskService.availableBytes()

      i.e.

      com.sonatype.nexus.exportimport.internal.exporttask.DiskService()
      public long availableBytes(final File file) throws IOException {
      
          long result = Files.getFileStore(file.toPath()).getUsableSpace();
              if (result < 0) {
                  // see https://bugs.openjdk.java.net/browse/JDK-8162520:
                  result = Long.MAX_VALUE;
              }
              return result;
        }

      ^ admittedly a rubbish and short term fix (simply saying that the available disk space is Long.MAX_VALUE if we get a negative value back) but....

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              astrachan Alex Strachan
              CC:
              Victor Gavin
              Last Updated By:
              Rich Seddon Rich Seddon
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Date of First Response:

                  tigCommentSecurity.panel-title