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

Attempting to rebuild browse nodes for deleted repositories results in NullPointerException on startup

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.7.1
    • Fix Version/s: 3.11.0
    • Component/s: Scheduled Tasks
    • Labels:
    • Story Points:
      2

      Description

      When a repository is deleted, it is marked as such by renaming it to an obscure name in the database. This renaming will allow an end user to avoid referential integrity issues should they wish to create a new repository with the same name.

      When scheduled tasks run against "All Repositories", the list may include these obscurely named deleted repos. An example where this was seen in practice is in the following logging in Nexus 3.7.1 at startup:

      2018-02-26 14:50:58,110-0600 INFO  [quartz-5-thread-6] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask - Task information:
      2018-02-26 14:50:58,119-0600 INFO  [quartz-5-thread-6] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask -  ID: 6ef855ce-ca44-4fd5-a4d2-073243c5a31d
      2018-02-26 14:50:58,119-0600 INFO  [quartz-5-thread-6] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask -  Type: create.browse.nodes
      2018-02-26 14:50:58,119-0600 INFO  [quartz-5-thread-6] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask -  Name: Rebuild repository browse tree - (nuget-org$bd2642ad-f5ed-4fd6-a393-94171560b19a)
      2018-02-26 14:50:58,119-0600 INFO  [quartz-5-thread-6] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask -  Description: Rebuilding browse tree for nuget-org$bd2642ad-f5ed-4fd6-a393-94171560b19a
      2018-02-26 14:50:58,125-0600 ERROR [quartz-5-thread-6] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask - Failed to run task 'Rebuilding browse tree for nuget-org$bd2642ad-f5ed-4fd6-a393-94171560b19a'
      java.lang.NullPointerException: null
      	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770)
      	at org.sonatype.nexus.repository.RepositoryTaskSupport.findRepositories(RepositoryTaskSupport.java:89)
      	at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:66)
      	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)
      2018-02-26 14:50:58,125-0600 INFO  [quartz-5-thread-6] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask - Task complete
      2018-02-26 14:50:58,153-0600 INFO  [quartz-5-thread-3] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask - Task information:
      2018-02-26 14:50:58,153-0600 INFO  [quartz-5-thread-3] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask -  ID: 16b41512-b6cc-45cd-9b85-b2b7d743e28b
      2018-02-26 14:50:58,154-0600 INFO  [quartz-5-thread-3] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask -  Type: create.browse.nodes
      2018-02-26 14:50:58,154-0600 INFO  [quartz-5-thread-3] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask -  Name: Rebuild repository browse tree - (nuget-org)
      2018-02-26 14:50:58,154-0600 INFO  [quartz-5-thread-3] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask -  Description: Rebuilding browse tree for nuget-org
      2018-02-26 14:51:00,858-0600 INFO  [quartz-5-thread-3] node1 *SYSTEM org.sonatype.nexus.repository.storage.BrowseNodeStoreImpl - Deleted 712 browse nodes for repository nuget-org in 2.704 s
      2018-02-26 14:51:10,083-0600 INFO  [quartz-5-thread-3] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask - rebuilding tree for 0 assets took 1 ms of 9177 ms, 7356 / 7356 assets processed
      2018-02-26 14:51:10,084-0600 INFO  [quartz-5-thread-3] node1 *SYSTEM org.sonatype.nexus.repository.browse.internal.RebuildBrowseNodesTask - Task complete
      
      

      Expected

      Mainly the NullPointerException should not happen.

      Since deleted repos are effectively "gone" - tasks should not be able to retrieve a list of repositories that includes deleted repositories by default. If there is a valid use case for processing deleted repos with a task, the task should explicitly handle asking for a list which may include them ( although I am unaware of such use case at this time ).

        Attachments

          Activity

            People

            Assignee:
            jbryan Jeremy Bryan
            Reporter:
            plynch Peter Lynch
            Last Updated By:
            Peter Lynch
            Team:
            Nexus - Core
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title