Repository navigation
Description
Hello,
trying to perform a git lfs fetch but it just hangs (0 B/s for a while) and then quit with
LFS: Client error: https://api.media.atlassian.com/file/992a6467-031c-499d-841f-19711e45640d/binary
The command
GIT_TRACE=1 GIT_CURL_VERBOSE=1 git lfs fetch
results in a long series of errors like this one below:
< HTTP/1.1 400 Bad Request < Connection: close < Content-Length: 167 < Access-Control-Allow-Origin: * < Access-Control-Expose-Headers: Accept-Ranges, Content-Encoding, Content-Length, Content-Range < Content-Type: application/json < Date: Thu, 24 Jan 2019 15:14:19 GMT < Strict-Transport-Security: max-age=15552000; includeSubDomains < X-B3-Spanid: 13f3b59a8f95a973 < X-B3-Traceid: 13f3b59a8f95a973 < X-Content-Type-Options: nosniff < X-Dns-Prefetch-Control: off < X-Download-Options: noopen < X-Frame-Options: SAMEORIGIN < X-Xss-Protection: 1; mode=block < 15:14:22.479535 trace git-lfs: HTTP: {"error":{"code":"InvalidArgumentError","title":"range first index must not be greater than last index","href":"https://api.media.atlassian.com#InvalidArgumentError"}} {"error":{"code":"InvalidArgumentError","title":"range first index must not be greater than last index" ,"href":"https://api.media.atlassian.com#InvalidArgumentError"}}15:14:22.479535 trace git-lfs: tq: retr ying object 77dfe7e27990ba66880d64d5423e862b37cb7461405cdc03789e3bf055a050e1: LFS: Client error: https: //api.media.atlassian.com/file/7392df22-bf24-4717-aa21-7efb92efa827/binary 15:14:22.479535 trace git-lfs: tq: enqueue retry #1 for "77dfe7e27990ba66880d64d5423e862b37cb7461405cdc 03789e3bf055a050e1" (size: 122880044) 15:14:22.588244 trace git-lfs: filepathfilter: rewrite ".git" as "**/.git/**" 15:14:22.588244 trace git-lfs: filepathfilter: rewrite "**/.git" as "**/.git" 15:14:22.588244 trace git-lfs: filepathfilter: rejecting "tmp" via [] 15:14:22.588244 trace git-lfs: filepathfilter: accepting "tmp"
I'd put this in evidence as should be relevant:
trace git-lfs: HTTP: {"error":{"code":"InvalidArgumentError","title":"range first index must not be greater than last index","href":"https://api.media.atlassian.com#InvalidArgumentError"}
I suspected the service was down but all operational on the bitbucket status page.
What am I doing wrong?
Activity
bk2204 commentedon Jan 24, 2019
Hey, sorry you've having trouble.
It sounds like what's happened is that one or more of the files you're trying to download are partially downloaded, and for some reason they have more data than they're supposed to. When we download a file, we send a
Rangeheader if the file already exists, and the server has complained that the low end of the range is larger than the high end (which is of course nonsensical).I have a branch on my remote called
retry-on-oversize-file. Can you try it and see if it fixes your problem?Apo- commentedon Jan 25, 2019
@rstecca I've been having the same issue since yesterday (repo is also hosted on bitbucket).
I got this issue when CI was pulling, so then I tried cloning the repo locally, but then I get
Encountered <n> file(s) that should have been pointers, but weren't. Thegit lfs migrate importandgit lfs uninstall && git reset --harddidn't work. If I try tolfs pullanyway I get the same error and alsoUnsolicited response received on idle HTTP channel starting with.@bk2204 I don't get what you meant by
bk2204 commentedon Jan 25, 2019
@Apo- I have a commit on the branch at https://github.com/bk2204/git-lfs/tree/retry-on-oversize-file which I think will address this bug. If possible, it would be nice if you or @rstecca could compile that branch and see if it fixes the
InvalidArgumentErrorerrors that you're seeing. (It won't fix any other errors that you're seeing, though.)Apo- commentedon Jan 28, 2019
@bk2204 It didn't do the trick for me, but I'm posting the process I followed in case it solves @rstecca problem (for Ubuntu 18.04):
alexander-north commentedon Jan 29, 2019
I've encountered this exact error - also on Bitbucket with git LFS. I've tried everything I can think of. Increased LFS timeouts, disabled smudge, nothing works.
In my case it's occurring for 34 different files.
Updates:
This issue eventually resolved itself after about 15 painful repeat clones of a 20GB project. Then it came back.
As per @Apo- 's ticket on https://bitbucket.org/site/master/issues/18064/git-lfs-fetch-fails-with and his workaround there, the following command allows git pulls for LFS projects:
GIT_LFS_SKIP_SMUDGE=1 git pullThis, however, ended up causing some significant file corruption, so I wouldn't recommend it.
fraserr commentedon Jan 29, 2019
Having the same issue also.
MattShaile commentedon Jan 29, 2019
I'm also having this problem. I've tried fresh checkouts, reinstalling git, rolling back to an older version of git & lfs (matching a colleagues who is not getting the issue in the same repo) but yet it still occurs, every time, on the same files.
Since it only happens to me it must be to do with environment, but can't for the life of me figure out what is causing it
In case the error is slightly different / is helpful in any way, below is
git lfs logs lastApo- commentedon Jan 30, 2019
I opened an issue on bitbucket as well in case this is not a git-lfs issue https://bitbucket.org/site/master/issues/18064/git-lfs-fetch-fails-with
MattShaile commentedon Feb 1, 2019
I contacted bitbucket support and they've fixed the issue for me! Here is their response:
bbain commentedon Feb 4, 2019
TL;DR: Trying remove the files in your
.git/lfs/incompletedirectory and try again.I think I have tracked down what is happening here. There was an outage at Atlassian where a % of requests bad corrupted downloads of the correct size.
When the
git-lfsis downloading a file its placed into.git/lfs/incomplete. Whengit-lfsgot enough data (i.e. the file is of the correct size) it detected that the download was bad and returned an error. The problem is that the temporary file of correct size in.git/lfs/incompleteis still there.From this point on
git lfs fetchor whatever will fail. Thegit-lfssees the temporary file and incorrectly assumes that more data is required. It issues a HTTP request withRangeheader where starting from the temporary filesize + 1. Well, this is invalid because filesize + 1 is beyond the EOF.I would assume that:
git-lfsshouldn't try and do a partial download when all the temporary file is the right size (but maybe wrong content).git-lfsprobably should delete temporary files that it detects as corrupted and just try again. Maybe this happens for free if the step 1 is implemented. This could introduce its own loop I guess.This is pretty easy to fake:
cat /dev/urandom > .git/lfs/incomplete/<file>.tmp. Kill before the tmp file reaches the size of the LFS file.git lfs pull. Make sure the upstream supports partial downloads. This will fail with an error.git lfs pull. This will issue HTTP requests with Range past the end of the file.bk2204 commentedon Feb 4, 2019
I think it's certainly fair that we retry if we get the wrong amount of data or would issue an invalid Range request. I believe the proposed branch does that.
However, I'm not sure retrying when our download has data and it's corrupt is a good idea, since generally our data has come over an HTTPS connection, which verifies its integrity. That's a situation that we would want to produce an error for, which we do. In fact, doing so probably led to Bitbucket noticing that there was a problem.
bbain commentedon Feb 4, 2019
OK. The main problem is that the
git-lfswill end up fail loop that a user wont know how to fix. Maybe a message telling users that something is very wrong and here's how to retry (e.g. by deleting this file)?bk2204 commentedon Feb 6, 2019
I think it's fine to delete the file and retry, which is what my branch does in this case. I plan to spend a few minutes verifying this case and writing up some tests, and then submitting it.
rstecca commentedon Feb 12, 2019
Thank you all for the responses. This is all very insightful. I also found that the combination Git-lfs + bitbucket + ssh is very problematic in itself and it causes misterious failures (even now that @RustyGames had bitbucket people's support), cul-de-sacs and cryptic errors. It can be difficult to understand what's failing. Recloning through https seems to be the way to avoid some of the snake pits. Not a solution but at least there's one way to not waste hours, days or weeks until ssh support is more solid. I want to switch back to ssh as soon as possible so I'll keep checking here and try @bk2204 's tricks.
@bbain amazing investigation. Good to keep in mind for future failures.
rstecca commentedon Feb 12, 2019
@bk2204
I'm very curious to see what's the minimal failure case here. Can you post it?
Oh yes please. A meaningful error for this could have saved a lot of time for me. Cool that this post and your efforts escalated to bitbucket!
bk2204 commentedon Feb 12, 2019
I've opened #3518 which has a test for this case, which should demonstrate the problem. My hope is that it will make it into Git LFS 2.7.0.
t: fix object transfer HTTP download retry test
t: fix object transfer HTTP download retry test