Repository navigation
Description
Describe the issue
In our CI environment, we run git lfs fetch followed by a git lfs checkout to properly pull down/populate large fixture objects in our repo from git LFS pointers, needed to run our tests. Randomly (anecdotally, seems to be about 5% of the time) the git lfs checkout step silently fails (see logs below), leaving the local repo checkout in a dirty state (unexpected/undesired behavior for CI environment for obvious reasons)
To break this apart, there's at least 2 issues/problems for us here:
git lfs checkoutis failing (see error message and stack trace below) and we cannot figure out why- when the above failure occurs, the
git lfs checkoutprocess still exits cleanly (exit code 0), despite failing and leaving our repo in a dirty state.
Any help in debugging the first problem would be very much appreciated, and any thoughts on if the second is an expected behavior (and if so, why) or if it's worth opening a separate bug report issue would also be helpful. Thanks!
System environment
CircleCI job, running with their Docker Executor, using a variety of images (observed on cimg/go:1.17, cimg/ruby:2.7.5-node, cimg/node:14.18.1-browsers, cimg/node:14.18.1, etc)
git lfs is not installed by default on any of these base cimg images, so it is installed each run using the following bash
# Skip installing git-lfs if already present
if ! command -v git-lfs &> /dev/null; then
curl -sL https://github.com/git-lfs/git-lfs/releases/download/v3.1.2/git-lfs-linux-amd64-v3.1.2.tar.gz -o git-lfs.tar.gz \
&& tar -xzf git-lfs.tar.gz \
&& sudo ./install.sh
fi
git-lfs --version # Print out version for debugging
cd ~/build && git lfs install # Finally, install it in the repoError logged to ~/build/.git/lfs/logs/20220428T065800.570779134.log
git-lfs/3.1.2 (GitHub; linux amd64; go 1.17.6)
git version 2.35.1
$ git-lfs checkout
Error updating the Git index:
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
github.com/git-lfs/git-lfs/v3/git.(*FilterProcessScanner).readRequest(0xc0000a3b48)
work/git-lfs/git-lfs/git/filter_process_scanner.go:188 +0x245
github.com/git-lfs/git-lfs/v3/git.(*FilterProcessScanner).Scan(0xc0000a3b48)
work/git-lfs/git-lfs/git/filter_process_scanner.go:152 +0x76
github.com/git-lfs/git-lfs/v3/commands.filterCommand(0xc000125900, {0x9be0d9, 0x0, 0x0})
work/git-lfs/git-lfs/commands/command_filter_process.go:74 +0x345
github.com/spf13/cobra.(*Command).execute(0xc000125900, {0xe710b8, 0x0, 0x0})
go/pkg/mod/github.com/spf13/[email protected]/command.go:766 +0x5f8
github.com/spf13/cobra.(*Command).ExecuteC(0xc000124000)
go/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x2dc
github.com/spf13/cobra.(*Command).Execute(...)
go/pkg/mod/github.com/spf13/[email protected]/command.go:800
github.com/git-lfs/git-lfs/v3/commands.Run()
work/git-lfs/git-lfs/commands/run.go:107 +0x2ed
main.main()
work/git-lfs/git-lfs/git-lfs.go:34 +0xea
error: packet write with format failed
error: external filter 'git-lfs filter-process' failed
fatal: title-vi/fixtures/orig_map_trips.json: clean filter 'lfs' failed
exit status 128
Current time in UTC:
2022-04-28 06:58:00
Environment:
LocalWorkingDir=/home/circleci/remix
LocalGitDir=/home/circleci/remix/.git
LocalGitStorageDir=/home/circleci/remix/.git
LocalMediaDir=/home/circleci/remix/.git/lfs/objects
LocalReferenceDirs=
TempDir=/home/circleci/remix/.git/lfs/tmp
ConcurrentTransfers=8
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=/home/circleci/remix/.git/lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic,lfs-standalone-file,ssh
UploadTransfers=basic,lfs-standalone-file,ssh
GIT_EXEC_PATH=/usr/lib/git-core
GIT_TRACE=1
Client IP addresses:
192.168.240.3
If relevant, include the output of
git config -las a code block.
url.ssh://[email protected]=https://github.com
gc.auto=0
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
[email protected]:[redacted]/[redacted].git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
lfs.repositoryformatversion=0
Output of git lfs env
git-lfs/3.1.2 (GitHub; linux amd64; go 1.17.6)
git version 2.33.0
Endpoint=https://github.com/[redacted]/[redacted].git/info/lfs (auth=none)
[email protected]:[redacted]/[redacted].git
LocalWorkingDir=/home/circleci/build
LocalGitDir=/home/circleci/build/.git
LocalGitStorageDir=/home/circleci/build/.git
LocalMediaDir=/home/circleci/build/.git/lfs/objects
LocalReferenceDirs=
TempDir=/home/circleci/build/.git/lfs/tmp
ConcurrentTransfers=8
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=/home/circleci/build/.git/lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic,lfs-standalone-file,ssh
UploadTransfers=basic,lfs-standalone-file,ssh
GIT_EXEC_PATH=/usr/lib/git-core
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"
Additional context
I was able to capture a failure while running git lfs fetch && GIT_TRACE=1 git lfs checkout. You can view the trace output in this gist (omitting only the redundant listing of all files in our repo and other repeated lines)
Activity
[-]Help triaging git-lfs failure/crash[/-][+]Help triaging git-lfs checkout failure[/+]bk2204 commentedon Apr 28, 2022
Hey,
Thanks for reporting this. I think the thing that would be interesting to me is to see the output when it fails with both
GIT_TRACE=1andGIT_TRACE_PACKET=1. This panic indicates that we're getting an entry in the Git filter-process output that doesn't contain a key-value pair. This is easy enough to fix, but it would be useful to know what it is just so we can write a suitable test.oderby commentedon May 2, 2022
Hey @bk2204 I've reproduced again with both env vars set. I uploaded the packet output and the offending file to a new gist. Hope that helps!
bk2204 commentedon May 2, 2022
Hey,
Thanks for that information. Unfortunately, it doesn't look like it tells me what the problematic pkt-line is, so I'm just going to have to fix it without writing a test. Could you try #4974 to see if it fixes your issue? CI should build binaries when it's done (which you can grab from the Actions log page) if you need them.
oderby commentedon May 3, 2022
Okay, with the built binary from #4982, the git-lfs checkout made further progress, but now fails occasionally with a different error :/ gist with full log file output:
bk2204 commentedon May 4, 2022
Hmmm. I can't reproduce the problem from the trace output, and this indicates that we likely have a protocol violation on one end or the other. I know that Git strips out newlines from the trace output, so that isn't entirely unexpected.
Do you maybe have a repository where you can reproduce this that I could look at? Does it reproduce with a stock version of Git from upstream (or at least a distro package)?
oderby commentedon May 10, 2022
This dropped off my radar @bk2204, apologies.
Unfortunately I only have it reproducing on a private repo that I can't share.
I'm not sure what you mean here - the docker containers this is being run in installs git from ubuntu upstream, so i'd hope that's stock git?
Separately, the other issue/quesiton that hasn't been discussed yet is why this panic doesn't cause the
git lfs checkoutcommand to exit with a non-zero exit code? That is, when this error occurs, git lfs seems to continue happily as if nothing was wrong, but leaves my git index in a dirty state...which was surprising and confusing to me (and caused us to miss this in CI for quite some time since our git lfs checkout job happily finished, despite being in a dirty state)bk2204 commentedon May 10, 2022
I'm not sure why it's exiting nonzero here because I can't reproduce it, unfortunately. Could you take the code from the
debug-filter-process-no-commandbranch on bk2204/git-lfs, build it, and see if Git LFS logs the error "found unknown request" in the trace output? That would help us figure out what's going on in this case.oderby commentedon May 10, 2022
@bk2204 I've built the branch you indicated and the error still reproduces. I do not see any line with the string "found unknown request" in the trace output.
I'm not sure it's relevant, but I'm noticing that it seems every time git lfs fails, the file being processed is one of several large ndjson formatted files we have in LFS - is it possible that something (hard to imagine what though) related to those files specifically would be causing issues for the LFS client?
oderby commentedon May 10, 2022
Indeed - if I
git rmall the ndjson files from our repo, this issue no longer reproduces. I'm sure it's not ndjson specifically, but that seems like a potential hint as to building a repro case - maybe make a repo with a bunch of copies of these large ndjson files?bk2204 commentedon May 12, 2022
Okay, since we can't seem to reproduce this and trace output doesn't seem to be effective here, I'm going to mark this as need a reproduction case. If we can get a repo that demonstrates the problem, we'll be happy to look into it further.
artem-sidorenko commentedon Jun 23, 2022
@bk2204 it looks like I can reproduce this problem more or less pretty stable. But same for me, it happens in the CI on the private repo I can't share. It looks like a some kind of run-time issue for me - it breaks one of 20 CI runs for us.
Logs look very similar to the posted above:
without debug environment variables
with debug environment variables
GIT_TRACE=1andGIT_TRANSFER_TRACE=1:I'm happy to provide more information and help to investigate it
51 remaining items
ravenAtSafe commentedon Aug 13, 2025
This sounds like something we are experiencing as well (periodically, maybe increasing in frequency with the number of LFS files, maybe just coming and going)
git lfs pullin a Linux CI environment, it returns without indicating any errorStrangely it is almost always the same file, despite that file not being anywhere near as large as other LFS files in the repo. 600MB bad vs 1GB fine.
It's possible that this scenario occurs only after a different LFS problem, where an LFS pull takes so long that Jenkins times it out - possibly that results in a corrupted state that manifests like this in later pulls?
Update: I'm increasingly convinced that a Jenkins timeout is involved. Sometimes the timeouts result in the checkouts (including lfs pull) being reported as an error and sometimes not despite clearly being logged as an error. This is using the builtin
checkout()function in Jenkins, configured to LFS pull as well. So maybe this is on Jenkins rather than git.lfs: export maximum pointer blob size cutoff value
t: add test helper to retrieve program limits
lfs,t: restore progress log in clean filter
commands: ignore file size when cleaning in merges
t/t-filter-process.sh: use getlimit in new test
t/t-filter-process.sh: update and rename new test
t/t-clean.sh: add file size mismatch test