Skip to content

batch response: Post .../objects/batch: EOF  #2314

Closed

Description

@larsxschneider

Hi,

I have a largish Git repo with 15k files (~8 GB) in GitLFS. On a particular machine the git lfs clone operation fails with this error:

batch response: Post https://<server>/<org>/<repo>.git/info/lfs/objects/batch: EOF 
error: failed to push some objects to 'https://<server>/<org>/<repo>.git/info/lfs'

Environment:

  • Windows 7
  • Git 2.11
  • Git LFS 2.1.1
  • Git LFS config:
[lfs]
    batch = true
    ConcurrentTransfers = 10

[lfs "transfer"]
    maxretries = 10

I was able to reproduce the problem with GIT_TRACE and GIT_CURL_VERBOSE enabled:
(in case it is relevant: there is no character/newline between }]}trace)

trace git-lfs: Filled credentials for https://<server>/<org>/<repo>.git
trace git-lfs: HTTP: POST https://<server>/<org>/<repo>.git/info/lfs/objects/batch
> POST /<org>/<repo>.git/info/lfs/objects/batch HTTP/1.1
> Host: <server>
> Accept: application/vnd.git-lfs+json; charset=utf-8
> Authorization: Basic * * * * *
> Content-Length: 8936
> Content-Type: application/vnd.git-lfs+json; charset=utf-8
> User-Agent: git-lfs/2.1.1 (GitHub; windows amd64; go 1.8.1; git 3314e287)
>
{"operation":"download","objects":[{"oid":...many objects...}]}trace git-lfs: api error: Post https://<server>/<org>/<repo>.git/info/lfs/objects/batch: EOF

I wasn't able to pinpoint the problem, yet, but here are a few observations. Please note, the problem happens regularly but not all the time. Therefore an observation might not be be true in general (I don't have a large sample size as all operations take ages because of the large repo):

  • I experienced the problem only with git lfs clone. git lfs pull and git lfs fetch (after deleteting all files in the worktree as well as .git/lfs) worked in all tests on the particular machine.
  • I was not able to reproduce the problem with Git LFS 1.5.6 (release version) on the particular machine.
  • I was not able to reproduce the problem with Git LFS 2.1.1 compiled with golang 1.7.3 on the particular machine.
  • I was not able to reproduce the problem with Git LFS 2.1.1 (release version, compiled with golang 1.8.1) on a machine running Windows 8 which is closer to the Git LFS server.

Questions

  • The Batch API uses a HTTP POST operation to request the LFS objects. POST is defined non idempotent. That's why we generally cannot retry POST requests. However, the request of the LFS objects should be idempotent, no? Should we retry this request?
  • The error failed to push some objects is a bit misleading to the user on a Git clone operation. Should we rephrase that?
  • Do you have any other idea how I could debug this further? I wonder if there is a bigger problem or just a flaky network that could be fixed with retries.

Thanks,
Lars

/cc @terrorobe

Activity

  1. terrorobe commented on Jun 12, 2017

    @terrorobe
    Contributor

    Just a small followup, for the single incident where we had the verbose curl output as well as the haproxy logs from the appliance, evidence pointed at the fact that the EOF'd batch request never reached the LFS server.

  2. larsxschneider commented on Jun 12, 2017

    @larsxschneider
    MemberAuthor

    I compiled Git LFS 2.1.1 with golang 1.8.1. This should exactly match the currently released version. However, 3 different "clones" with the released version yield the error 3 times. 3 different "clones" with my own version did not fail once. Any idea what the problem might be? Just bad luck?

  3. terrorobe commented on Jun 13, 2017

    @terrorobe
    Contributor

    3 experiments which are 3-0 against our shipped version looks like it's a statistically significant result.

    I'm wondering if you could capture a failing session using mitmproxy's mitmdump. This would show us if the problem happens between the Git LFS process and the kernel or between your computer and the LFS server.

    If you need help in configuring mitmproxy let me know. LFS will honour proxy configuration from both the git config and the environment.

  4. ttaylorr commented on Jun 13, 2017

    @ttaylorr
    Contributor

    Hey @larsxschneider 😄. Sorry you're having trouble. Sorry that you're having trouble; I'm pretty curious about why the issue only sometimes occurs. Here are a few other notes from your original issue:

    As you noted, all of the POST requests that are defined in the LFS API are idempotent. We don't retry the request at a network/HTTP layer (source). That being said, for every failed item in a batch request (or all items, if the entire API call fails), the items are enqueued to be retried and are issued again in a new batch request (source). In effect, it should appear as if we are retrying the HTTP request multiple times.

    • The error failed to push some objects is a bit misleading to the user on a Git clone operation. Should we rephrase that?

    I agree, I think that we should change that for the next version.

    • Do you have any other idea how I could debug this further? I wonder if there is a bigger problem or just a flaky network that could be fixed with retries.

    I'm not sure. I'm happy to dive in further, but at first blush this appears to be network related.

  5. larsxschneider commented on Jun 13, 2017

    @larsxschneider
    MemberAuthor

    Thanks @ttaylorr !

    we are retrying the HTTP request multiple times.

    I can see this error in the log:

    trace git-lfs: HTTP: POST https://server/org/repo.git/info/lfs/objects/batch
    > POST /org/repo.git/info/lfs/objects/batch HTTP/1.1
    > Host: server
    > Accept: application/vnd.git-lfs+json; charset=utf-8
    > Authorization: Basic * * * * *
    > Content-Length: 8936
    > Content-Type: application/vnd.git-lfs+json; charset=utf-8
    > User-Agent: git-lfs/2.1.1 (GitHub; windows amd64; go 1.8.1; git 3314e287)
    >
    {"operation":"download","objects":[{"oid":"ab1e49d0820fcf024268eeee7b750c0426a7128fde5d929c1aabdfc19cd67468",...,"size":270336}]}trace git-lfs: api error: Post https://server/org/repo.git/info/lfs/objects/batch: EOF
    

    Wouldn't that mean that I should see at least one other POST call that requests {"operation":"download","objects":[{"oid":"ab1e49d0820fcf024268eeee7b750c0426a7128fde5d929c1aabdfc19cd67468",...?

    It's not there, although retry is activated. Is it possible there is a bug in the retry mechanism?

  6. ttaylorr commented on Jun 13, 2017

    @ttaylorr
    Contributor

    It's not there, although retry is activated. Is it possible there is a bug in the retry mechanism?

    Interesting. That makes me think that whatever error that tq.Batch() is returning is not "retriable" as according to errors.IsRetriableError() (source, source & source).

    EDIT: errors.NewRetriableError() has no callers in scope of the github.com/git-lfs/git-lfs/lfsapi package:

    ~/g/git-lfs (migrate-subcommand-info) $ guru -scope github.com/git-lfs/git-lfs/lfsapi callers ./errors/types.go:#7319              
    /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/errors/types.go:330:6: github.com/git-lfs/git-lfs/errors.NewRetriableError is called from these 1 sites:
    /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/tools/iotools.go:100:36:      static function call from (*github.com/git-lfs/git-lfs/tools.RetriableReader).Read
    

    But I think that #2312 could help with this issue.

  7. larsxschneider commented on Jun 22, 2017

    @larsxschneider
    MemberAuthor

    @ttaylorr When do you plan to release #2312 ? The "trouble" is that I cannot reproduce my problem with my own builds.

  8. ttaylorr commented on Jun 22, 2017

    @ttaylorr
    Contributor

    @ttaylorr When do you plan to release #2312 ? The "trouble" is that I cannot reproduce my problem with my own builds.

    My plan is to release #2312 as a part of v2.2.0 on either this Friday (23 June, 2017) or the following Monday (26 June, 2017).

    Were you unable to confirm a fix building against #2312?

  9. larsxschneider commented on Jun 22, 2017

    @larsxschneider
    MemberAuthor

    Well, I was not able to reproduce the problem with my locally build v2.1.1. IOW: #2312 could not fix anything. I haven't analyzed the network traffic, yet, as suggested by @terrorobe .

  10. ttaylorr commented on Jun 22, 2017

    @ttaylorr
    Contributor

    I haven't analyzed the network traffic, yet, as suggested by @terrorobe .

    I would be curious to see what the results of your findings are. I would also suggest to attach a Delve debugger session to LFS and see if you can figure out whether specific network errors cause that errors to be marked as retry-able or not.

    If you decide to go this route, make sure to compile LFS with DWARF tables included (via script/bootstrap --dwarf). You can run your built copy of LFS via dlv exec ./bin/git-lfs <args> with a few runtime.Breakpoint() calls in the code.

  11. larsxschneider commented on Jun 22, 2017

    @larsxschneider
    MemberAuthor

    Can I attach the Delve debugger to the released version of Git LFS?

  12. ttaylorr commented on Jun 22, 2017

    @ttaylorr
    Contributor

    Can I attach the Delve debugger to the released version of Git LFS?

    You would have to rebuild with the --dwarf flag at the v2.1.1 tag, since LFS releases are compiled without DWARF tables.

  13. larsxschneider commented on Jun 22, 2017

    @larsxschneider
    MemberAuthor

    As I said above: I am not able to reproduce the problem with a locally build GitLFS version of the v2.1.1 tag! I build with ./script/bootstrap! Is this the way you build the official version?

  14. ttaylorr commented on Jun 22, 2017

    @ttaylorr
    Contributor

    As I said above: I am not able to reproduce the problem with a locally build GitLFS version of the v2.1.1 tag!

    Ah, my mistake -- I had forgot you mentioned that in this thread.

    I build with ./script/bootstrap! Is this the way you build the official version?

    This is how I compile the release binaries. The Linux packages require extra tooling, but are at their core running binaries built with script/bootstrap.

  15. larsxschneider commented on Jun 28, 2017

    @larsxschneider
    MemberAuthor

    I just replicated the problem with the latest release 2.2.0 which means #2312 does not fix the issue. Stay tuned for more detailed debugging infos.

  16. terrorobe commented on Aug 1, 2017

    @terrorobe
    Contributor

    After looking through a packet capture of the client we can now confirm that git-lfs does not create a TCP connection for the failing API requests, it errors out before that. The writeup in ZD#45772 contains detailed information.

    @ttaylorr - Can you recommend a way on how to debug this problem further? We'd like to know why the requests are failing. Is there debug logging, tracing mechanism or similar approaches we can use to gather more information from inside Go?

  17. deleted a comment from on Sep 19, 2017
  18. deleted a comment from on Sep 19, 2017
  19. deleted a comment from on Sep 19, 2017
  20. gumparthisarma commented on May 27, 2019

    @gumparthisarma

    batch response: Unable to parse HTTP response for POST , still we are facing issues with this error.

  21. gumparthisarma commented on May 27, 2019

    @gumparthisarma

    19:37:14.730320 trace git-lfs: HTTP: 200
    Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done
    batch response: Unable to parse HTTP response for POST /info/lfs/objects/batch: EOF

  22. bk2204 commented on May 28, 2019

    @bk2204
    Member

    Hey, could you open a new issue for this and run the command with GIT_TRACE=1 GIT_TRANSFER_TRACE=1 GIT_CURL_VERBOSE=1? I think what you're seeing is possibly a different issue, and I'd like to handle it separately from this issue.

  23. bit-rocket commented on Oct 29, 2021

    @bit-rocket

    I have come across the same issue.
    And resolved by unset the git proxy settings.

    http_proxy="socks5://127.0.0.1:1080"
    https_proxy="socks5://127.0.0.1:1080"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions