-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
High
-
Affects Version/s: 12.1.7
-
Component/s: Bamboo Specs
-
None
-
1
-
Severity 2 - Major
-
3
Issue Summary
Bamboo Specs detection performs unconditional submodule/LFS fetch causing event thread stalls on repositories with large submodule trees.
There is no guard to skip submodule/LFS work when the user only needs to read bamboo-specs/ for specs operations.
This causes the Specs detection path to execute:
Full git fetch of the entire repository
git submodule update --init --recursive --force --depth=2147483647 git submodule foreach git fetch --update-shallow --depth=2147483647
Steps to Reproduce
N/A
Expected Results
Bamboo Specs detection should only fetch the repository content sufficient to read bamboo-specs/ and compare the revision hash. Submodule initialisation, recursive submodule updates, and per-submodule LFS fetches should not be performed during Specs detection, as submodule contents are not required to determine whether Bamboo Specs have changed.
Actual Results
Every push event triggers a full recursive submodule update (--depth=2147483647) followed by a per-submodule fetch unconditionally in the Specs detection path, regardless of whether bamboo-specs/ content has changed. For repositories with large submodule trees this takes huge time, blocking the event thread indefinitely due to the unbounded Future.get() in RssTriggeringServiceImpl.triggerRss().
for (Future<?> rssDetectionTask : rssDetectionTasks) { try { rssDetectionTask.get(); } catch (Exception e) { throw BambooThrowables.propagate(e); } }
Workaround
workaround 1:
Use two separate repositories (one for builds, one for specs scanning, with the specs repo having no submodules or LFS)
workaround 2: Alternative workaround is to use the following Byteman script: To implement see How to enable Byteman in Bamboo for details on enabling and loading Byteman scripts.
RULE BAM-26506 skip submodule update for bamboo specs detection CLASS com.atlassian.bamboo.plugins.git.GitCommandProcessor METHOD runSubmoduleUpdateCommand AT ENTRY BIND accessData = $1; workDir = $2; depth = $3 ? 1 : 2147483647; bmLog = org.apache.logging.log4j.LogManager.getContext($0.getClass().getClassLoader(), false).getLogger("com.atlassian.bamboo.plugins.git.GitCommandProcessor") IF Thread.currentThread().getName().contains("SpecsDetection") DO bmLog.warn("[BAM-26506] SKIPPED submodule phase for Bamboo Specs detection" + " | repositoryName=" + accessData.getRepositoryName() + " | repo=" + accessData.getObfuscatedRepositoryUrl() + " | branch=" + accessData.getVcsBranch().getName() + " | cwd=" + workDir.getAbsolutePath() + " | useSubmodules=" + accessData.isUseSubmodules() + " | shallowSubmodules=" + $3 + " | lfsCapable=" + accessData.isLfs() + " | reuseSshKeyForSubmodules=" + accessData.isReuseSshKeyForSubmodules() + " | suppressed=[git submodule update --init --recursive --force --quiet --depth=" + depth + "] and [git submodule foreach git fetch --update-shallow --quiet --depth=" + depth + "]"); return; ENDRULE