Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git rev-list hangs infinitely

Tags:

git

ssh

If I do git clone - it works perfect.

But if after it I try to use git pull it hungs (sometimes work fine):

git client version: 2.6.3

git server version: 2.1.4

output:

$ GIT_CURL_VERBOSE=1 GIT_TRACE=1 git pull 10:20:56.507549 git.c:348 trace: built-in: git 'pull' 10:20:56.508283 run-command.c:343 trace: run_command: 'fetch' '--update-head-ok' 10:20:56.508877 exec_cmd.c:128 trace: exec: 'git' 'fetch' '--update-head-ok' 10:20:56.511135 git.c:348 trace: built-in: git 'fetch' '--update-head-ok' 10:20:56.520316 run-command.c:343 trace: run_command: 'ssh' 'git@server' 'git-upload-pack '\''/vol/git/repos/repo.git'\''' 10:20:58.384437 run-command.c:343 trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'

like image 930
user3611630 Avatar asked Nov 09 '22 01:11

user3611630


1 Answers

The situation might improve five years later with Git 2.29 (Q4 2020), and the use of more buffered I/O where we used to call many small write(2)s.

See commit a698d67, commit 6af3b00, commit 24b75fa (12 Aug 2020) by René Scharfe (rscharfe).
(Merged by Junio C Hamano -- gitster -- in commit d8488b9, 24 Aug 2020)

upload-pack: use buffered I/O to talk to rev-list

Helped-by: Chris Torek
Helped-by: Johannes Sixt

Like f0bca72dc77 ("send-pack: use buffered I/O to talk to pack-objects", 2016-06-08, Git v2.10.0-rc0 -- merge listed in batch #3), significantly reduce the number of system calls and simplify the code for sending object IDs to rev-list by using stdio's buffering.

Take care to handle errors immediately to get the correct error code, and to flush the buffer explicitly before closing the stream in order to catch any write errors for these last bytes.

like image 147
VonC Avatar answered Nov 15 '22 10:11

VonC