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

Attempting to create Azure blob store with an existing name causes 500 server error

    Details

    • Type: Bug
    • Status: New
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.38.0, 3.37.3
    • Fix Version/s: None
    • Component/s: Azure, Blobstore
    • Labels:
    • Notability:
      2

      Description

      Attempting to create an Azure blob store with a name that already belongs to an existing store returns the following 500 server error (caused by a duplicate key violation):

      2022-04-27 17:27:22,018+0100 WARN  [qtp556198592-842] admin org.sonatype.nexus.siesta.internal.UnexpectedExceptionMapper - (ID 59e848f6-8c08-4031-9c1d-e4da10330150) Unexpected exception: com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot index record #43:2: found duplicated key 'nagrahs1' in index 'repository_blobstore_name_idx' previously assigned to the record #43:1
      	DB name="config" INDEX=repository_blobstore_name_idx RID=#43:1
      com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot index record #43:2: found duplicated key 'nagrahs1' in index 'repository_blobstore_name_idx' previously assigned to the record #43:1
      	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:855)
      	at com.orientechnologies.orient.core.index.sbtree.local.OSBTree.validatedPut(OSBTree.java:261)
      	at com.orientechnologies.orient.core.index.engine.OSBTreeIndexEngine.validatedPut(OSBTreeIndexEngine.java:169)
      	at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doValidatedPutIndexValue(OAbstractPaginatedStorage.java:2519)
      	at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.validatedPutIndexValue(OAbstractPaginatedStorage.java:2488)
      	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:1904)
      	at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.commit(OAbstractPaginatedStorage.java:1861)
      	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:2908)
      	at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2870)
      	at org.sonatype.nexus.orient.transaction.OrientTransaction.commit(OrientTransaction.java:74)
      	at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:69)
      	at org.sonatype.nexus.transaction.Operations.proceedWithTransaction(Operations.java:232)
      	at org.sonatype.nexus.transaction.Operations.transactional(Operations.java:223)
      	at org.sonatype.nexus.transaction.Operations.run(Operations.java:175)
      	at org.sonatype.nexus.orient.transaction.OrientOperations.run(OrientOperations.java:62)
      	at org.sonatype.nexus.repository.internal.blobstore.orient.OrientBlobStoreConfigurationStore.create(OrientBlobStoreConfigurationStore.java:85)
      

      This also prevents the Blob Stores UI page from loading (see fail_blobstore_ui.png attached) with the following 404 warning in the nexus.log:

      2022-04-27 17:28:35,720+0100 WARN  [qtp556198592-845] admin org.sonatype.nexus.siesta.internal.UnexpectedExceptionMapper - (ID a4373a54-19fb-4d0d-8ac4-a74561d56200) Response: [500] 'ERROR: (ID a4373a54-19fb-4d0d-8ac4-a74561d56200) com.azure.storage.blob.models.BlobStorageException: Status code 404, (empty body)'; mapped from: com.azure.storage.blob.models.BlobStorageException: Status code 404, (empty body)
      

      To reproduce:

      1. Create an Azure blob store.
      2. Using the REST API, POST /v1/blobstores/azure, attempt to create another blob store with the same name as the existing store.
      3. Then attempt to access the Blob Stores page in the UI.

      Expected:

      Similar to the validation performed for File blob stores, attempting to create an Azure blob store with an existing name should return a 400 response with the following message: "Name is already used, must be unique (ignoring case)" and the Blob Stores UI page should not break.

      Workaround:

      To fix the broken Blob Stores UI page, either restart the Nexus instance and if a new blob store is needed, then reissue the API call with a unique blob store name.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            hardeepn Hardeep Nagra
            Last Updated By:
            Rich Seddon Rich Seddon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                tigCommentSecurity.panel-title