Empty repository caches page in Bamboo

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.

Summary

The Manage caches tab inside the Bamboo administration > Overview > Build resources > Repository settings page is empty and does not display any repositories even though there are Git repositories being built by Bamboo. 

Environment

Bamboo 7.2+

Diagnosis

The following actions can be taken to diagnose the issue and confirm that you're running into the problem described in this article:

  1. Open up the <bamboo-home>/logs/atlassian-bamboo-access.log file after attempting to load the Bamboo administration > Overview > Build resources > Repository settings page and look for the thread responsible to handle your web request. Here's an example of what to look for:

    2023-01-05 13:08:36,887 INFO [http-nio-8085-exec-10] [AccessLogFilter] user01 GET https://mybamboo.com/bamboo/admin/repositorySettings.action 941816kb
  2. Once you identify the thread (in this case http-nio-8085-exec-10) open up the <bamboo-home>/logs/atlassian-bamboo.log file and see if you can find any exceptions thrown for the same thread at the same time:

    2023-01-05 13:08:36,922 ERROR [http-nio-8085-exec-10] [runtime] Error executing FreeMarker template

    If you're getting a FreeMarker template error when attempting to load the page there's a great chance you're affected by the problem described in this page.

Cause

Below you'll find two known causes to this issue:

Cause 1 - Obsolete CVS repositories

CVS repositories were deprecated in Bamboo 7.1 and the plugin that manages those repositories was removed from Bamboo starting on version 7.2.

If you ever configured a CVS repository in Bamboo that was not removed before upgrading the application to version 7.2 or higher the following error will be displayed in the <bamboo-home>/logs/atlassian-bamboo.log file. You can use the same approach outlined in the Diagnosis section to find the error message:

2022-09-14 16:07:53,074 ERROR [https-jsse-nio-8443-exec-75] [runtime] Error executing FreeMarker template
FreeMarker template error:
An error has occurred when reading existing sub-variable "cacheDescriptions"; see cause exception! The type of the containing value was: extended_hash+string (com.atlassian.bamboo.plugins.git.GitRepository wrapped into f.e.b.StringModel)

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #list cacheProvider.cacheDescriptions...  [in template "admin/repositorySettings.ftl" in macro "manageCachesTab" at line 78, column 17]
	- Reached through: @ww.form action="repositorySettingsDe...  [in template "admin/repositorySettings.ftl" in macro "manageCachesTab" at line 39, column 9]
	- Reached through: @manageCachesTab  [in template "admin/repositorySettings.ftl" at line 19, column 9]
	~ Reached through: #nested  [in template "lib/dojo.ftl" in macro "contentPane" at line 98, column 5]
	~ Reached through: @dj.contentPane labelKey="manageCache...  [in template "admin/repositorySettings.ftl" at line 18, column 5]
	~ Reached through: #nested  [in template "lib/dojo.ftl" in macro "tabContainer" at line 66, column 5]
	~ Reached through: @dj.tabContainer headingKeys=["manage...  [in template "admin/repositorySettings.ftl" at line 17, column 1]
----

Java stack trace (for programmers):
----
...
	at freemarker.ext.beans.BeanModel.get(BeanModel.java:152)
	... 305 more
Caused by: io.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IllegalStateException: Cannot load repository with key com.atlassian.bamboo.plugin.system.repository:cvs. Plugins may have been disabled.
	at io.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:156)
...
	at com.atlassian.bamboo.plugins.git.GitRepository.getCacheDescriptions(GitRepository.java:1182)
	... 312 more
Caused by: java.lang.IllegalStateException: Cannot load repository with key com.atlassian.bamboo.plugin.system.repository:cvs. Plugins may have been disabled.
	at com.google.common.base.Preconditions.checkState(Preconditions.java:590)

Cause 2 - Repositories with empty commandTimeout inside the database

Git repositories with an empty commandTimeout option (Repository configuration > Advanced Options > Command timeout) will break the rendering of the Bamboo administration > Overview > Build resources > Repository settings page as Bamboo is expecting a value there when loading up the repository configuration.

Bamboo will throw the following error message inside the <bamboo-home>/logs/atlassian-bamboo.log file when attempting to load a Git repository with an empty or invalid commandTimeout option. You can use the same approach outlined in the Diagnosis section to find the error message:

2022-10-13 09:44:58,570 ERROR [https-jsse-nio-8443-exec-15] [runtime] Error executing FreeMarker template
FreeMarker template error:
An error has occurred when reading existing sub-variable "cacheDescriptions"; see cause exception! The type of the containing value was: extended_hash+string (com.atlassian.bamboo.plugins.git.GitRepository wrapped into f.e.b.StringModel)

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #list cacheProvider.cacheDescriptions...  [in template "admin/repositorySettings.ftl" in macro "manageCachesTab" at line 78, column 17]
	- Reached through: @ww.form action="repositorySettingsDe...  [in template "admin/repositorySettings.ftl" in macro "manageCachesTab" at line 39, column 9]
	- Reached through: @manageCachesTab  [in template "admin/repositorySettings.ftl" at line 19, column 9]
	~ Reached through: #nested  [in template "lib/dojo.ftl" in macro "contentPane" at line 98, column 5]
	~ Reached through: @dj.contentPane labelKey="manageCache...  [in template "admin/repositorySettings.ftl" at line 18, column 5]
	~ Reached through: #nested  [in template "lib/dojo.ftl" in macro "tabContainer" at line 66, column 5]
	~ Reached through: @dj.tabContainer headingKeys=["manage...  [in template "admin/repositorySettings.ftl" at line 17, column 1]
----

Java stack trace (for programmers):
----
freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...]
	at freemarker.ext.beans.BeanModel.get(BeanModel.java:185)
	at freemarker.core.Dot._eval(Dot.java:43)

	..
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
..
	at freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:233)
	at freemarker.ext.beans.BeanModel.get(BeanModel.java:152)
	... 305 more
Caused by: io.atlassian.util.concurrent.LazyReference$InitializationException: org.apache.commons.configuration.ConversionException: 'repository.git.commandTimeout' doesn't map to an Integer object
	at io.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:156)
	at io.atlassian.util.concurrent.LazyReference.get(LazyReference.java:116)
	at com.atlassian.bamboo.repository.LegacyRepositoryDataImpl.getRepository(LegacyRepositoryDataImpl.java:134)
...	
	at com.atlassian.bamboo.plugins.git.GitRepository.getCacheDescriptions(GitRepository.java:1182)
	... 312 more
Caused by: org.apache.commons.configuration.ConversionException: 'repository.git.commandTimeout' doesn't map to an Integer object
	at org.apache.commons.configuration.AbstractConfiguration.getInteger(AbstractConfiguration.java:880)
	at io.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:332)
	at io.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:150)
	... 353 more
Caused by: org.apache.commons.configuration.ConversionException: Could not convert  to java.lang.Integer
	at org.apache.commons.configuration.PropertyConverter.toNumber(PropertyConverter.java:312)
	at org.apache.commons.configuration.PropertyConverter.toInteger(PropertyConverter.java:157)
	at org.apache.commons.configuration.AbstractConfiguration.getInteger(AbstractConfiguration.java:876)
	... 359 more
Caused by: java.lang.NumberFormatException: For input string: ""
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.base/java.lang.Integer.parseInt(Integer.java:662)
	...
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at org.apache.commons.configuration.PropertyConverter.toNumber(PropertyConverter.java:308)
	... 361 more

 

Solution

Below you'll find the solutions to the two known causes described in the Cause section of this article:

Solution 1 - Obsolete CVS repositories

The following instructions will guide you to remove data from Bamboo so please make sure you take a full backup of your application before proceeding.

You will have to remove the CVS repositories from Bamboo in order to be able to load the repository caches page again.

  1. The first step is to find the CVS repositories and the plans that are linked to them. You can use the the following SQL queries to do so:

    Plans with linked CVS repositories
     SELECT pln.full_key "Full Key",
           cvcs.name "Repository Name"
    FROM   build pln
            JOIN plan_vcs_location pvl
              ON pln.build_id = pvl.plan_id
            JOIN vcs_location cvcs
            JOIN vcs_location vcs
              ON cvcs.parent_id = vcs.vcs_location_id
              ON pvl.vcs_location_id = cvcs.vcs_location_id
    WHERE  vcs.plugin_key = 'com.atlassian.bamboo.plugin.system.repository:cvs'
     
    Plans with Plan (or local) CVS repositories
    SELECT pln.full_key "Full Key",
           vcs.NAME "Repository Name"
    FROM   build pln
            JOIN plan_vcs_location pvl
              ON pln.build_id = pvl.plan_id
            JOIN vcs_location vcs
              ON pvl.vcs_location_id = vcs.vcs_location_id
    WHERE  vcs.parent_id IS NULL
    AND    vcs.plugin_key = 'com.atlassian.bamboo.plugin.system.repository:cvs' 
    All CVS repositories inside Bamboo
    SELECT name,
           vcs_location_id,
           is_global,
           marked_for_deletion,
           parent_id
    FROM   vcs_location
    WHERE  plugin_key='com.atlassian.bamboo.plugin.system.repository:cvs'
  2. After identifying the CVS repositories, take note of ALL of the vcs_location_id provided by all 3 queries and delete the CVS repositories from the Bamboo UI.
    1. Due to the way the deletion mechanism works in Bamboo your CVS repositories will not necessarily be permanently removed from them from the database when you remove then from the UI, but will be marked for deletion.
  3. In order to permanently delete the CVS repositories that have been marked for deletion you must remove all build results that are linked to those repositories.

    Removing individual build results linked to CVS repositories can be a long process if you have several plans and/or build results linked to those CVS repositories. The following steps are not needed if you decide to delete the entire plans instead of individual build results.

  4. You can find the build results that have to be deleted using the following SQL query:

    Find which build results are linked the removed repositories
    SELECT
        vcs_location.vcs_location_id               AS REPO_ID,
        vcs_location.name                          AS REPO_NAME,
        repository_changeset.buildresultsummary_id AS BUILDRESULT_ID,
        buildresultsummary.build_key               AS BUILD_KEY,
        buildresultsummary.build_number            AS BUILD_NUMBER
    FROM
        vcs_location
    LEFT JOIN
        public.repository_changeset
    ON
        vcs_location.vcs_location_id = repository_changeset.vcs_location_id
    LEFT JOIN
        public.buildresultsummary
    ON
        repository_changeset.buildresultsummary_id = buildresultsummary.buildresultsummary_id
    WHERE
        vcs_location.vcs_location_id IN ( vcs_location_id_1,                                      
    									 vcs_location_id_2,
     									 vcs_location_id_3,
     									 vcs_location_id_4)

    Replace vcs_location_id_X in the query above with the IDs that you saved in step 2.

  5. After you identify the plans from which the results belong to you can edit the expiry setting of those plans to ensure that all results are removed.

    1. This will ensure that build results are removed while keeping the plan configuration intact in case you need it for future reference.

After the plans and/or build results have been removed Bamboo will be able to delete the CVS repositories that have been marked for deletion in step 2. Once the CVS repositories have been completely removed by Bamboo the repository caches page should start working and displaying your repositories again.

Solution 2 - Repositories with empty commandTimeout inside the database

The issue is caused by a known bug:

BAM-21989 - Getting issue details... STATUS  

  • Upgrade Bamboo to a version that contains the fix to the bug mentioned above or higher. This bug was fixed and released in the following versions: 9.1.0, 8.2.7, and 9.0.2.
  • Identify the Git repositories with an empty commandTimeout using the following SQL query and re-save the repository configuration with a valid commandTimeout from the Bamboo UI:

    SELECT *
      FROM vcs_location
     WHERE xml_definition_data LIKE '%<string>repository.git.commandTimeout</string><string></string>%';
Last modified on Jan 11, 2023

Was this helpful?

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