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

healthcheck.properties can contain references to repositories that do not exist causing 3.6.1 upgrade to fail

    XMLWordPrintable

    Details

      Description

      Initial report here: https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/d9ec0f47-2b7c-4b1e-95a0-ffb32999f1c0%40glists.sonatype.com?utm_medium=email&utm_source=footer

      2017-11-20 08:56:28,738+0100 ERROR [FelixStartLevel]  *SYSTEM org.sonatype.nexus.extender.NexusContextListener - Failed to start nexus
      com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot index record #85:2: found duplicated key 'activiti.enabled' in index 'healthcheckconfig_property_name_idx' previously assigned to the record #87:3
      	DB name="config"
      	at com.orientechnologies.orient.core.index.OIndexUnique$1.validate(OIndexUnique.java:47)
      	at com.orientechnologies.orient.core.index.OIndexUnique$1.validate(OIndexUnique.java:37)
      	at com.orientechnologies.orient.core.index.sbtree.local.OSBTree.put(OSBTree.java:873)
      	at com.orientechnologies.orient.core.index.sbtree.local.OSBTree.validatedPut(OSBTree.java:267)
      	at com.orientechnologies.orient.core.index.engine.OSBTreeIndexEngine.validatedPut(OSBTreeIndexEngine.java:169)
      	at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doValidatedPutIndexValue(OAbstractPaginatedStorage.java:2462)
      	at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.validatedPutIndexValue(OAbstractPaginatedStorage.java:2431)
      	at com.orientechnologies.orient.core.index.OIndexUnique.put(OIndexUnique.java:82)
      	at com.orientechnologies.orient.core.index.OIndexUnique.put(OIndexUnique.java:35)
      	at com.orientechnologies.orient.core.index.OIndexAbstract.putInSnapshot(OIndexAbstract.java:956)
      	at com.orientechnologies.orient.core.index.OIndexAbstract.applyIndexTxEntry(OIndexAbstract.java:790)
      	at com.orientechnologies.orient.core.index.OIndexAbstract.addTxOperation(OIndexAbstract.java:762)
      	at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.commitIndexes(OAbstractPaginatedStorage.java:1848)
      	at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.commit(OAbstractPaginatedStorage.java:1806)
      	at com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransactionOptimistic.java:541)
      	at com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:99)
      	at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2907)
      	at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2876)
      	at org.sonatype.nexus.orient.transaction.OrientTransaction.commit(OrientTransaction.java:83)
      	at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:67)
      	at org.sonatype.nexus.transaction.Operations.transactional(Operations.java:200)
      	at org.sonatype.nexus.transaction.Operations.run(Operations.java:155)
      	at org.sonatype.nexus.orient.transaction.OrientOperations.run(OrientOperations.java:63)
      	at com.sonatype.nexus.plugins.healthcheck.service.impl.ConfigDatabaseUpgrade_1_4.apply(ConfigDatabaseUpgrade_1_4.java:88)
      	at org.sonatype.nexus.upgrade.internal.UpgradeServiceImpl.lambda$3(UpgradeServiceImpl.java:195)
      	at java.util.ArrayList.forEach(ArrayList.java:1249)
      	at org.sonatype.nexus.upgrade.internal.UpgradeServiceImpl.doUpgrade(UpgradeServiceImpl.java:137)
      	at org.sonatype.nexus.upgrade.internal.UpgradeServiceImpl.doStart(UpgradeServiceImpl.java:93)
      	at org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport.start(StateGuardLifecycleSupport.java:67)
      	at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
      	at org.sonatype.nexus.common.stateguard.StateGuard$TransitionImpl.run(StateGuard.java:191)
      	at org.sonatype.nexus.common.stateguard.TransitionsInterceptor.invoke(TransitionsInterceptor.java:56)
      	at org.sonatype.nexus.extender.NexusLifecycleManager.startComponent(NexusLifecycleManager.java:153)
      	at org.sonatype.nexus.extender.NexusLifecycleManager.to(NexusLifecycleManager.java:93)
      	at org.sonatype.nexus.extender.NexusContextListener.frameworkEvent(NexusContextListener.java:188)
      	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1429)
      	at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
      	at java.lang.Thread.run(Thread.java:748)
      

      I already tried to remove the 'activiti' proxy repository in the old version and launched the upgrade again, but it resulted in exactly the same error.

      There was a double entry in ../sonatype-work/nexus3/etc/healthcheck.properties (case was different but name was exactly the same):

      activiti.enabled=false
      Activiti.enabled=false

      After removing the last one, the upgrade worked fine.

      Workaround

      Remove any entries in healthcheck.properties file that reference repositories that don't actually exist.

      Root Cause

      When deleting repositories in 3.6.0, the matching healthcheck entry is not removed from healthcheck.properties file.

      Expected

      • When a repository is deleted, all healthcheck configuration should be also deleted.
      • The upgrade step should anticipate this bug and not fail upgrade by verifying the repo exists and the not add index entries for repos that don't exist

        Attachments

          Activity

            People

            Assignee:
            wwannemacher Wes Wannemacher
            Reporter:
            plynch Peter Lynch
            Last Updated By:
            Peter Lynch
            Team:
            Nexus - Platform
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title