Could not update chain with key {BambooKey}-{planKey} as it's being modified in another thread.
Asked by suryap666:

My spec

```
BambooServer bambooServer = new BambooServer("{bamboo url here}");
final PlanSpec planSpec = new PlanSpec();

final Plan plan = planSpec.plan();
bambooServer.publish(plan);

final PlanPermissions planPermission = planSpec.planPermission("SIT");
bambooServer.publish(planPermission);

final Deployment rootObject = planSpec.deployment();
bambooServer.publish(rootObject);

final DeploymentPermissions deploymentPermission = planSpec.deploymentPermission();
bambooServer.publish(deploymentPermission);

final EnvironmentPermissions environmentPermission1 = planSpec.environmentPermission1();
bambooServer.publish(environmentPermission1);

final EnvironmentPermissions environmentPermission2 = planSpec.environmentPermission2();
bambooServer.publish(environmentPermission2);

//runner test
final PlanSpec planSpecRunner = new PlanSpec();

final Plan planRunnerOnTest = planSpecRunner.planRunnerOnTest();
bambooServer.publish(planRunnerOnTest);

final PlanPermissions planRunnerOnTestPermission = planSpecRunner.planPermission("SITR");
bambooServer.publish(planRunnerOnTestPermission);

//runner pre-prod
final PlanSpec planSpecRunnerPreProd = new PlanSpec();

final Plan planRunnerOnPreProd = planSpecRunnerPreProd.planRunnerOnPreProd();
bambooServer.publish(planRunnerOnPreProd);

final PlanPermissions planRunnerOnPreProdPermission = planSpecRunnerPreProd.planPermission("SITRP");
bambooServer.publish(planRunnerOnPreProdPermission);
```

```


java.lang.IllegalStateException: Could not update chain with key DISI-SIT as it's being modified in another thread.15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.modifyExistingTopLevelPlan(PlanConfigImportServiceImpl.java:467)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.lambda$importPlan$0(PlanConfigImportServiceImpl.java:424)15-Jan-2021 11:58:16		at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)15-Jan-2021 11:58:16		at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:28)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.importPlan(PlanConfigImportServiceImpl.java:403)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.rss.DefaultSpecsConsumer.importPlanProperties(DefaultSpecsConsumer.java:120)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.rss.importers.PlanImporterProvider.lambda$getEntityProvider$1(PlanImporterProvider.java:38)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.rss.AllTypesSpecsImporter.importBambooYamlsWithImporter(AllTypesSpecsImporter.java:88)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.rss.AllTypesSpecsImporter.importBambooYamlsOfAllTypes(AllTypesSpecsImporter.java:52)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.rss.JavaSpecsImportServiceImpl.lambda$processSpecs$2(JavaSpecsImportServiceImpl.java:77)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.rss.SpecsOptimizeProcessor.processSpecs(SpecsOptimizeProcessor.java:42)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.rss.JavaSpecsImportServiceImpl.processSpecs(JavaSpecsImportServiceImpl.java:63)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.runBambooSpecs(RepositoryStoredSpecsServiceImpl.java:175)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.RssDetectionServiceImpl.runRssDetection(RssDetectionServiceImpl.java:330)15-Jan-2021 11:58:16		at com.atlassian.bamboo.configuration.external.detection.RssDetectionRunnable.run(RssDetectionRunnable.java:42)15-Jan-2021 11:58:16		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)15-Jan-2021 11:58:16		at java.util.concurrent.FutureTask.run(FutureTask.java:266)15-Jan-2021 11:58:16		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)15-Jan-2021 11:58:16		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)15-Jan-2021 11:58:16		at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)15-Jan-2021 11:58:16		at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)15-Jan-2021 11:58:16		at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)15-Jan-2021 11:58:16		at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)15-Jan-2021 11:58:16		at java.lang.Thread.run(Thread.java:748)
```


Answers:
author: suryap666
body: The same thing works when I scan from Linked repo.