Duplicate capability breaks Server capability
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
After the upgrade of Bamboo from 7.2.10 to 8.0+, if a duplicate capability was inherited, attempts to add server capabilities will break Bamboo UI, and a similar error will be seen in atlassian-bamoo.log
file.
2023-06-15 16:25:54,519 ERROR [http-nio-8085-exec-14] [FiveOhOh] 500 Exception was thrown.
java.lang.IllegalStateException: Duplicate key system.builder.mvn3.Maven = /usr/lib/maven/apache-maven-3.2.6 (null)
at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
at java.util.HashMap.merge(HashMap.java:1255)
at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at com.atlassian.bamboo.v2.build.agent.capability.CapabilitySetImpl$CapabilitiesByKeys.create(CapabilitySetImpl.java:47)
at com.atlassian.bamboo.v2.build.agent.capability.CapabilitySetImpl$CapabilitiesByKeys.create(CapabilitySetImpl.java:37)
at com.atlassian.bamboo.utils.concurrent.TransientLazyReference.get(TransientLazyReference.java:27)
at com.atlassian.bamboo.v2.build.agent.capability.CapabilitySetImpl.getCapability(CapabilitySetImpl.java:72)
at com.atlassian.bamboo.v2.build.agent.capability.CapabilitySetImpl.addCapability(CapabilitySetImpl.java:97)
at com.atlassian.bamboo.builder.DefaultJdkManager.addDefaultJdkToCapabilitySet(DefaultJdkManager.java:32)
...
Diagnosis
Execute the SQL to search for the affected capability key_identifier
SELECT FROM CAPABILITY c
WHERE C.KEY_IDENTIFIER LIKE '%system.builder.mvn3.Maven'
Output in Json:
{
"capability_id" : 1048624,
"key_identifier" : "system.builder.mvn3.Maven",
"value" : "\/usr\/lib\/maven\/apache-maven-3.2.6",
"source_mask" : 4,
"capability_set" : 1015813
},
{
"capability_id" : 1048625,
"key_identifier" : "system.builder.mvn3.Maven",
"value" : "\/usr\/lib\/maven\/apache-maven-3.2.6",
"source_mask" : null,
"capability_set" : 1015813
}
]}
Here you will find that one or more of the duplicate record has a source mask of null "source_mask", and the others have a numeric value.
In version < 7.10, duplicate capability entry in the database does not break Bamboo, but when its upgraded to version 8.2.8, Server capabilities will be broken.
Solution
- This is fixed in Bamboo 9.0+.
- Or as a last resort ( Because we do not support the use of
DELETE
query), Use SQL query to delete the capability paired records with the null source_mask.