Skip to content

Git push succeeds even if LFS server is down #673

Closed

Description

@davidbernard04

The issue #609 addressed the 401 failure case, but what about other types of upload failures?

I've tested some push scenarios when the LFS server is not reachable (or down), and the git push always succeed, even though the files are never uploaded.

Here are the git push traces, deliberately using a bad FQDN for the LFS server:

[/Projects/Stash/test_dbernard_lfs]$ GIT_TRACE=1 git push origin master
14:02:37.004276 git.c:346               trace: built-in: git 'push' 'origin' 'master'
14:02:37.005836 run-command.c:351       trace: run_command: 'ssh' '-p' '7999' 'git@stash' 'git-receive-pack '\''/drag/test_dbernard_lfs.git'\'''
14:02:37.245966 run-command.c:351       trace: run_command: '.git/hooks/pre-push' 'origin' 'ssh://git@stash:7999/drag/test_dbernard_lfs.git'
14:02:37.255984 git.c:555               trace: exec: 'git-lfs' 'pre-push' 'origin' 'ssh://git@stash:7999/drag/test_dbernard_lfs.git'
14:02:37.257033 run-command.c:351       trace: run_command: 'git-lfs' 'pre-push' 'origin' 'ssh://git@stash:7999/drag/test_dbernard_lfs.git'
trace git-lfs: run_command: git rev-list --objects b6f0c92e6a4ad7d502dc2cdf5a4c5050146db619 --not --remotes=origin
trace git-lfs: run_command: git cat-file --batch-check
trace git-lfs: run_command: git cat-file --batch
trace git-lfs: run_command: 'git' config -l
trace git-lfs: run_command: 'git' config -l -f /Projects/Stash/test_dbernard_lfs/.gitconfig
trace git-lfs: run_command: 'git' config -l -f /Projects/Stash/test_dbernard_lfs/.git/config
trace git-lfs: tq: starting 3 transfer workers
trace git-lfs: tq: running as individual queue
trace git-lfs: api: uploading (ef89aa51c09cb36df05b35a9fd19e8dc59cea5f8b2cf26f14443f5759cd6870b)
trace git-lfs: HTTP: POST http://dbernard@artifactory_bad_fqdn/artifactory/api/lfs/lfs-local-dbernard/objects
(0 of 1 files) 0 B / 110.13 KB
14:02:37.309818 run-command.c:351       trace: run_command: 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
14:02:37.310341 exec_cmd.c:179          trace: exec: 'git' 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
14:02:37.312800 git.c:346               trace: built-in: git 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 393 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To ssh://git@stash:7999/drag/test_dbernard_lfs.git
   cbd07c2..b6f0c92  master -> master

Tested using these versions:

git-lfs/0.6.0 (GitHub; darwin amd64; go 1.5.1; git 183bdc8)
git version 2.3.2 (Apple Git-55)

Since I'm kinda new to both git and git-lfs, I may be doing something wrong here. ;)

So am I missing something, or the upload error cases really need to be stronger and prevent any push if the files are not uploaded properly?

Activity

  1. technoweenie commented on Sep 18, 2015

    @technoweenie
    Contributor

    Hmm, that's definitely not good. Do you have any idea what kind of response that HTTP POST returned?

    EDIT: I suppose if it's a bad fqdn, then it triggered a runtime error instead of an http 500 response or something.

  2. changed the title [-]Git push succeeds even when LFS server is down[/-] [+]Git push succeeds even if LFS server is down[/+] on Sep 18, 2015
  3. davidbernard04 commented on Sep 18, 2015

    @davidbernard04
    Author

    Well in that case the FQDN didn't even resolved to an IP address, so the POST was never actually sent on the network. But I also tested using a bad web server that returned 404 Not Found, and the push succeeded as well.

  4. rubyist commented on Sep 21, 2015

    @rubyist
    Contributor

    I'm able to reproduce with a bad FQDN for the legacy single operation API, but the batch API correctly exits with an error.

  5. davidbernard04 commented on Sep 21, 2015

    @davidbernard04
    Author

    @rubyist, many thanks for the fix.

    I have a question though. From the batch API documentation (https://github.com/github/git-lfs/blob/master/docs/api/http-v1-batch.md), it looks like the batch API is now enabled by default in 0.6. So how does the "fallback to legacy API" work when the server is not answering (bad FQDN) or is replying by some error code?

  6. rubyist commented on Sep 21, 2015

    @rubyist
    Contributor

    As currently implemented, the fallback to legacy does not happen for network related issues, only if a successful HTTP attempt is made and an appropriate error code returned. We do it this way because a legacy fallback will set a flag so the client will default to the legacy api for all future requests. We wouldn't want this to happen in the case of network problems, only if when we know for sure the server does not implement the batch API.

  7. davidbernard04 commented on Sep 21, 2015

    @davidbernard04
    Author

    Perfect, thank you!

  8. davidbernard04 commented on Sep 24, 2015

    @davidbernard04
    Author

    @rubyist, just tested your fix from master, and I confirm it works fine! Thanks.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions