NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.

      In some cases, it's possible for two labels to be created with the same name (even though we do checks for this). It can occur when there are two parallel requests (via the web or XML-RPC), which try to add the same (non-existent) label. Since they're in separate transactions, it's not possible to see that another session is trying to create the label, so both end up in the DB.

      Possible solutions to this:

      Write a periodic task that merges any duplicate labels (and the affected content)
      Isolate the sections of the current transaction in the save process, to narrow the window in which this can occur
      Add some sort of read/write filtering to the transaction so the changes can be seen before the transaction ends (??? - Scott's suggestion)

            [CONFSERVER-5254] Duplicate labels can be created by Concurrency Requests

            A fix for this issue is available in Confluence Data Center 9.1.0.
            Upgrade now or check out the Release Notes to see what other issues are resolved.

            Jordan Anslow added a comment - A fix for this issue is available in Confluence Data Center 9.1.0. Upgrade now or check out the Release Notes to see what other issues are resolved.

            Rilwan_Ahmed_NC added a comment - - edited

            We do see similar error while deleting space and space cannot be deleted in confluence server 7.13.7

            2022-08-30 04:34:16,383 ERROR [Long running task: Space removal long running task] [persistence.dao.hibernate.HibernateLabelDao] lambda$findByLabel$0 There is more than one label named 'favourite' in the 'my' namespace.
             -- space: 204210206 | url: /spaces/doremovespace.action | traceId: 66d594bb93de1e11 | userName: xxxxxxxx| referer: https://XXXXXXXXXXXXX/spaces/removespace.action?key=ABC| action: doremovespace

            Rilwan_Ahmed_NC added a comment - - edited We do see similar error while deleting space and space cannot be deleted in confluence server 7.13.7 2022-08-30 04:34:16,383 ERROR [Long running task: Space removal long running task] [persistence.dao.hibernate.HibernateLabelDao] lambda$findByLabel$0 There is more than one label named 'favourite' in the 'my' namespace.  -- space: 204210206 | url: /spaces/doremovespace.action | traceId: 66d594bb93de1e11 | userName: xxxxxxxx| referer: https://XXXXXXXXXXXXX/spaces/removespace.action?key=ABC | action: doremovespace

            Version 7.13.0 server edition is also effected by this problem. I get a lot of error messages in the atlassion-confluence.log like this:

            // 2022-05-18 12:31:52,764 ERROR [http-nio-8090-exec-27] [persistence.dao.hibernate.HibernateLabelDao] lambda$findByLabel$0 There is more than one label named 'win10_iot' in the 'global' namespace.
             -- url: /confluence/admin/flushcontentindexqueue.action | traceId: e6032cda0391866b | userName: bernhard | action: flushcontentindexqueue 

            How can I fix this?

            Elias Tscharf added a comment - Version 7.13.0 server edition is also effected by this problem. I get a lot of error messages in the atlassion-confluence.log like this: // 2022-05-18 12:31:52,764 ERROR [http-nio-8090-exec-27] [persistence.dao.hibernate.HibernateLabelDao] lambda$findByLabel$0 There is more than one label named 'win10_iot' in the 'global' namespace.  -- url: /confluence/admin/flushcontentindexqueue.action | traceId: e6032cda0391866b | userName: bernhard | action: flushcontentindexqueue How can I fix this?

            also in server 7.4.5
            we got 2663 lines of the table LABEL with the NAME = "favourite" and the NAMESPACE = "my"
            is this really an error or a false positive?

            Robert Mota added a comment - also in server 7.4.5 we got 2663 lines of the table LABEL with the NAME = "favourite" and the NAMESPACE = "my" is this really an error or a false positive?

            We are also expiring this issue in Server 7.4.8.

            021-09-01 14:56:32,184 ERROR [Caesium-1-2] [persistence.dao.hibernate.HibernateLabelDao] lambda$findByLabel$0 There is more than one label named 'xxxxxxxxx' in the 'global' namespace.
            

            Lasse Bencke added a comment - We are also expiring this issue in Server 7.4.8. 021-09-01 14:56:32,184 ERROR [Caesium-1-2] [persistence.dao.hibernate.HibernateLabelDao] lambda$findByLabel$0 There is more than one label named 'xxxxxxxxx' in the 'global' namespace.

            If I remember correctly (it's been a while), I looked at the source code (I worked for a client with a corresponding licence) and the problem was that the method for adding label was not thread safe.

            I do not know if the implementation has changed. Back then it was possible when the server was under heavy load to add the same tag multiple times. If you look at the code the part should be not hard to find.

            Walter Kammergruber added a comment - If I remember correctly (it's been a while), I looked at the source code (I worked for a client with a corresponding licence) and the problem was that the method for adding label was not thread safe. I do not know if the implementation has changed. Back then it was possible when the server was under heavy load to add the same tag multiple times. If you look at the code the part should be not hard to find.

            Hi Everyone, I was not able to replicate this issue (in our newest Confluence to date, 6.15.7) by attempting to add a new label in parallel, one from REST API and another from the UI. Is it only replicable from the Service Rocket Scaffolding plugin? Please let us know here if you have more information!

            Monique Khairuliana (Inactive) added a comment - Hi Everyone, I was not able to replicate this issue (in our newest Confluence to date, 6.15.7) by attempting to add a new label in parallel, one from REST API and another from the UI. Is it only replicable from the Service Rocket Scaffolding plugin? Please let us know here if you have more information!

            The versions 6.8.3 and 6.13.4 are also affected by this problem.

            Deleted Account (Inactive) added a comment - The versions 6.8.3 and 6.13.4 are also affected by this problem.

            we are getting 100's of there messages where 'label-name' is one of about 10 different labels. 

             

            2019-01-30 10:38:22,418 ERROR [http-nio-8089-exec-454] [persistence.dao.hibernate.HibernateLabelDao] lambda$findByLabel$0 There is more than one label named 'label-name' in the 'global' namespace.

            iamgoingtosneeze added a comment - we are getting 100's of there messages where 'label-name' is one of about 10 different labels.    2019-01-30 10:38:22,418 ERROR [http-nio-8089-exec-454] [persistence.dao.hibernate.HibernateLabelDao] lambda$findByLabel$0 There is more than one label named 'label-name' in the 'global' namespace.

            I've seen a strange behavior related to this bug. When adding a label to a new page, if I type in the name of a label with the same name as an existing label but have different capitalization (e.g. "Star" instead of "star") and press RETURN, the label added is displayed as "star", but a search for label "star" doesn't pull the recently added page. Going back to the page, removing the label and typing in "star" or selecting from the existing labels will result in the page being properly found during a search. 

            Andrew Jones added a comment - I've seen a strange behavior related to this bug. When adding a label to a new page, if I type in the name of a label with the same name as an existing label but have different capitalization (e.g. "Star" instead of "star") and press RETURN, the label added is displayed as "star", but a search for label "star" doesn't pull the recently added page. Going back to the page, removing the label and typing in "star" or selecting from the existing labels will result in the page being properly found during a search. 

              5339cdd01cf4 Jeffery Xie
              8d92d19feb5e Jeremy Higgs
              Affected customers:
              31 This affects my team
              Watchers:
              40 Start watching this issue

                Created:
                Updated:
                Resolved: