Skip to content

Large number of branches cause timeout

ZD: https://gitlab.zendesk.com/agent/tickets/22337

Overview: Timeout when pushing a large number of branches to remote repo.

Reproduce:

Add "read_timeout" value to /opt/gitlab/embedded/service/gitlab-shell/config.yml - See gitlab-shell!37 (merged)

read_timeout: 300

Example bash script:

HOST=gitlab.com
USER=test
git clone git@$HOST:$USER/branch-test.git
cd branch-test
touch README.md
git add README.md
git commit -m "Add README"
for i in {1..100000}; do echo git checkout -b branch_00000000000$i;
done | sh -s
git push --all

gitlab-shell log file

DEBUG -- : Performing POST http://127.0.0.1:8080/api/v3/internal/allowed
WARN -- : Failed to connect to internal API <POST http://127.0.0.1:8080/api/v3/internal/allowed>: #<EOFError: end of file reached>

git push output

 ! [remote rejected] branch_0000000000099998 -> branch_0000000000099998 (pre-receive hook declined)
 ! [remote rejected] branch_0000000000099999 -> branch_0000000000099999 (pre-receive hook declined)
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@<EXAMPLE>/branch-test.git'

Possibly related to gitlab-shell