Build fails due to bad pack header error

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.

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

  1. 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" 

    (info) 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.

  2. Go to Overview > Repository Settings and manually clean the caches for all Git repositories

More details on Git configuration

Git configurationDescription
pack.windowMemoryThe maximum size of memory that is consumed by each thread.
pack.packSizeLimitThe maximum size of a pack.
pack.threadsSpecifies the number of threads to spawn when searching for the best delta matches.
pack.deltaCacheSizeThe maximum memory used for caching deltas before writing them out to a pack.

Last modified on May 17, 2023

Was this helpful?

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