Build fails due to bad pack header error
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Bamboo build fails with bad pack header in the logs.
Environment
All Bamboo versions.
Diagnosis
The following error appears in the <bamboo-home>/logs/atlassian-bamboo.log
:
Warning: Permanently added '[127.0.0.1]:32495' (RSA) to the list of known hosts.
Connection to 127.0.0.1 closed by remote host.
fatal: the remote end hung up unexpectedly
fatal: protocol error: bad pack header
Cause
This issue often indicates memory problems on the server.
Solution
Login to the Bamboo server as the Bamboo user used to start the service and run the commands below:
git config --global pack.windowMemory "100m" git config --global pack.packSizeLimit "100m" git config --global pack.threads "1" git config --global pack.deltaCacheSize "512m"
The memory values above may change according to each server. The values above are just a recommendation, but if the problem persists, feel free to adjust those memory values according to your server settings.
- Go to Overview > Repository Settings and manually clean the caches for all Git repositories
More details on Git configuration
Git configuration | Description |
---|---|
pack.windowMemory | The maximum size of memory that is consumed by each thread. |
pack.packSizeLimit | The maximum size of a pack. |
pack.threads | Specifies the number of threads to spawn when searching for the best delta matches. |
pack.deltaCacheSize | The maximum memory used for caching deltas before writing them out to a pack. |