git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Anyone know why git ls-remote output might be corrupted?
@ 2023-06-02 18:59 Paul Smith
  2023-06-02 19:12 ` Paul Smith
  2023-06-03  1:12 ` Elijah Newren
  0 siblings, 2 replies; 14+ messages in thread
From: Paul Smith @ 2023-06-02 18:59 UTC (permalink / raw)
  To: git

I have some scripting on my CI/CD servers that invokes git ls-remote
and parses the output.  The scripting is in Python.  Sometimes, but not
always, the output of this command is corrupted.  I've enhanced the
error handling and I see this:

>> git ls-remote --heads origin
*** INTERNAL: remote branch lookup failed:
Output:
-----
8431d80571dea5cc8e6d0848f27124f66346dcc4        refs/heads/foo1
aaec1feb1167cf3fbd39a36cdd7736679a9f4fae        refs/heads/foo2
6167c73fbaded389ff54d52a01878975f4a6d5e5        refs/heads/foo3
   ...
3a2e8036a6f6605d4dd14c72bd395298bff9d80e        refs/heads/xxx1
3a2e8036a6f6605d4dd14c72bd395298bff9d80e        refs/heads/xxx2
795d2ff669041fc91341cf5bf820aibab79dc92bd741e77a7dcf71d94285a6ae494dc0        refs/heads/yyy1
1496ea0ddab29ae3935754fced4bd5858cff7940        refs/heads/yyy2
1496ea0ddab29ae3935754fced4bd5858cff7940        refs/heads/yyy3
-----

Also a bunch of the heads are missing.  It's pretty clear that right in
the middle of printing one of the SHAs we suddenly lost a bunch of
output, and started printing stuff from later (in the last instance 66
out of 131 heads were missing).  Breaking down the output above you can
see:

  3a2e8036a6f6605d4dd14c72bd395298bff9d80e        refs/heads/xxx2
  795d2ff669041fc91341cf5bf820aibab79dc92bd741e77a7dcf71d94285a6ae494dc0        refs/heads/yyy1
                               ^

where the "795d2ff669041fc91341cf5bf820a" before the "i" char is a
valid start of a SHA for a head (not shown), then the "i", then a fully
valid SHA for heads/yyy1 which is 66 heads later.

I've seen this happen with different versions of Git on the client side
and on different OS's (Windows and Linux).  The only real constant here
is the Git server.

Is it feasible that this is an error on the server side?  Does the
server return formatted output for ls-remote?  I would naively have
expected it to return a binary representation of the heads, and the
formatting be done by the client.  But maybe not.

I should point out that subsequent runs in the same client work fine,
and when I log into the CI/CD client and run the command by hand I
can't reproduce it.  It's random.  I also can't find any errors printed
anywhere on either the server (we are using ssh access only for client
connections, managed via gitolite) or the client, except for the above.

Help, this is causing a few spurious failures in my CI/CD system per
day!

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-06-12 20:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-02 18:59 Anyone know why git ls-remote output might be corrupted? Paul Smith
2023-06-02 19:12 ` Paul Smith
2023-06-02 19:34   ` rsbecker
2023-06-02 19:53     ` Paul Smith
2023-06-02 20:02       ` rsbecker
2023-06-02 20:12         ` Paul Smith
2023-06-03  1:17         ` Elijah Newren
2023-06-03  1:12 ` Elijah Newren
2023-06-04  6:00   ` Jeff King
2023-06-04  6:25     ` Jeff King
2023-06-04  6:30       ` Jeff King
2023-06-09 15:33   ` Paul Smith
2023-06-09 18:58     ` Junio C Hamano
2023-06-12 19:59       ` Paul Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).