Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-8991

ERROR: duplicate key value violates unique constraint "uq_plug_setting_ns_key" in some Git LFS and Smart Mirroring operations

    XMLWordPrintable

Details

    Description

      This was seen once by fcobb during testing of Bitbucket LFS mirroring; and is also reproducible.

      Symptom:
      A Git LFS operation that involves an isEnabled check will typically fail with a status 500 error, and the following will be logged in atlassian-bitbucket.log:

      2016-06-06 12:46:27,886 WARN  [http-nio-7990-exec-10] admin @4X1LMTx766x1x0 0:0:0:0:0:0:0:1 "GET /rest/git-lfs/admin/enabled HTTP/1.1" o.h.e.jdbc.spi.SqlExceptionHelper SQL Error: 0, SQLState: 23505
      2016-06-06 12:46:27,886 ERROR [http-nio-7990-exec-10] admin @4X1LMTx766x1x0 0:0:0:0:0:0:0:1 "GET /rest/git-lfs/admin/enabled HTTP/1.1" o.h.e.jdbc.spi.SqlExceptionHelper Batch entry 0 insert into plugin_setting (key_name, namespace, key_value, id) values ('com.atlassian.bitbucket.server.bitbucket-git-lfs.enabled', 'bitbucket.global.settings', 'true', 142) was aborted.  Call getNextException to see the cause.
      ..
      

      See attachment error-log.txt for full error log.

      Sessions are only subject to seeing this for an instant while the "com.atlassian.bitbucket.server.bitbucket-git-lfs.enabled" setting is being persisted to the database; either a specific setting or the default value which is persisted the first time an "isEnabled" check is done. Once the plugin setting has been persisted to the database this problem can no longer occur.

      Reproduction

      Environment:

      • Bitbucket Server 4.8.0-SNAPSHOT (469f4ffa5d)
      • Postgresql 9.4.5

      1) Stop Bitbucket Server

      2) Delete plugin setting with key "com.atlassian.bitbucket.server.bitbucket-git-lfs.enabled" from the plugin_setting table:

      delete from plugin_setting where key_name = 'com.atlassian.bitbucket.server.bitbucket-git-lfs.enabled'
      

      3) In two terminal windows run the following (it seems this problem is a race condition and required two or more running)

      while true; do
      curl -v -u admin:admin -H "Content-Type:application/json" http://localhost:7990/bitbucket/rest/git-lfs/admin/enabled;
      done
      

      Change the password and/or base URL to suit your environment.

      4) Start Bitbucket Server; then once the above commands start seeing a status 200, check the atlassian-bitbucket.log file for the above mentioned error messages.

      Attachments

        Issue Links

          Activity

            People

              cszmajda Cristan Szmajda (Inactive)
              behumphreys Ben Humphreys
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: