Fail to upgrade due to java.lang.StackOverflowError

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

When upgrading from earlier than Bamboo 5.14.0, the upgrade task 51408 fail due to java.lang.StackOverflowError

The following appears in the atlassian-bamboo.log

2017-05-15 05:51:37,330 INFO [16-UpgradeTaskBackgroundThread:pool-32-thread-1] [AbstractUpgradeManager] -------------------------------------------------------------------------------------
2017-05-15 05:51:37,331 INFO [16-UpgradeTaskBackgroundThread:pool-32-thread-1] [AbstractUpgradeManager] 51408 : Move branch detection configuration from build configuration (post-bootstrap)
2017-05-15 05:51:37,331 INFO [16-UpgradeTaskBackgroundThread:pool-32-thread-1] [AbstractUpgradeManager] -------------------------------------------------------------------------------------
2017-05-15 05:51:59,702 FATAL [localhost-startStop-1] [UpgradeLauncher] Failed to upgrade Bamboo
java.util.concurrent.ExecutionException: java.lang.StackOverflowError
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at com.atlassian.bamboo.upgrade.UpgradeLauncher.upgradeAndStartBamboo(UpgradeLauncher.java:116)
	at com.atlassian.bamboo.upgrade.UpgradeLauncher.contextInitialized(UpgradeLauncher.java:44)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.StackOverflowError
	at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
	at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:242)
	at java.io.File.exists(File.java:819)
	at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:1245)
	at sun.misc.URLClassPath$FileLoader.findResource(URLClassPath.java:1212)
	at sun.misc.URLClassPath.findResource(URLClassPath.java:188)
	at java.net.URLClassLoader$2.run(URLClassLoader.java:569)
	at java.net.URLClassLoader$2.run(URLClassLoader.java:567)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findResource(URLClassLoader.java:566)
	at java.lang.ClassLoader.getResource(ClassLoader.java:1093)
	at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:232)
	at org.apache.catalina.loader.WebappClassLoaderBase.getResourceAsStream(WebappClassLoaderBase.java:1137)
	at org.apache.xerces.parsers.SecuritySupport$6.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.xerces.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
	at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
	at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
	at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
	at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
	at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
	at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
	at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
	at org.apache.commons.configuration.XMLConfiguration.createDocumentBuilder(XMLConfiguration.java:561)
	at org.apache.commons.configuration.XMLConfiguration.load(XMLConfiguration.java:664)
	at org.apache.commons.configuration.XMLConfiguration.load(XMLConfiguration.java:646)
	at com.atlassian.bamboo.utils.ConfigUtils.getXmlConfigFromXmlString(ConfigUtils.java:277)
	at com.atlassian.bamboo.utils.ConfigUtils.getXmlConfigFromXmlString(ConfigUtils.java:260)
	at com.atlassian.bamboo.utils.ConfigUtils.asXmlString(ConfigUtils.java:253)
	at com.atlassian.bamboo.repository.RepositoryDefinitionManagerImpl.decrypt(RepositoryDefinitionManagerImpl.java:398)
	at com.atlassian.bamboo.repository.RepositoryDefinitionManagerImpl.entityToUnmergedData(RepositoryDefinitionManagerImpl.java:169)

Diagnosis

Check if the following SQL query return any result:

SELECT * FROM BUILD 
JOIN PLAN_VCS_LOCATION ON BUILD_ID=PLAN_ID 
WHERE BUILD_TYPE="CHAIN_BRANCH" 
AND VCS_LOCATION_ID IN (SELECT VCS_LOCATION_ID FROM BUILD 
JOIN PLAN_VCS_LOCATION ON BUILD_ID=PLAN_ID 
WHERE BUILD_TYPE="CHAIN"); 

Cause

The Branch plan is somehow using the same VCS_LOCATION_ID as the Master plan.

Resolution

  1. Rollback Bamboo Home and database to the previous state before the upgrade
  2. Start Bamboo in the previous version
  3. Navigate to Plan Configuration > Branches (left panel) > <branch_name> > Source repository
  4. Uncheck the option “Override the plan's default repository”
  5. Save the setting
    This will delete the problematic data in the database
  6. Check the option again
  7. Make sure that the “Branch” field is correct
    It is fine if the branch name is the same as the master plan
  8. Save the setting
    This will generate a new repository ID instead of using the same repository ID as the master plan in the database
  9. Perform the upgrade again
Last modified on Jun 6, 2017

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.