Skip to content

Git LFS partial download #266

Closed
Closed

Description

@technoweenie

When a download in git lfs smudge is cancelled, it sometimes leave some trash in .git/lfs/objects:

$ ls -al .git/lfs/objects/ab/cd
total 43928
drwxr--r--  4 rick  staff    136 Apr 28 08:02 ./
drwxr--r--  3 rick  staff    102 Apr 28 08:02 ../
-rw-r--r--  1 rick  staff      0 Apr 28 08:02 abcd...
-rw-r--r--  1 rick  staff  13523 Apr 28 08:06 abcd...-temp

On a second git checkout, the 0-length file gets moved over to the working directory. My hunch is that the file gets opened for file locking purposes, but never cleaned up because the command was aborted.

Activity

  1. technoweenie commented on May 4, 2015

    @technoweenie
    ContributorAuthor

    Fixed in #267

  2. andyneff commented on Jul 14, 2015

    @andyneff
    Contributor

    I am still getting this error, with version 0.5.2 and using the lastest git-lfs (off of 2eef603)

    LocalWorkingDir=/dev/shm/blah2/vip_root
    LocalGitDir=.git
    LocalMediaDir=.git/lfs/objects
    TempDir=.git/lfs/tmp
    ConcurrentTransfers=3
    BatchTransfer=false
    GIT_DIR=.git
    GIT_PREFIX=
    
    Error accessing media: external/src/SOURCES/GDAL-1.11.2-cp27-none-win_amd64.whl (90bd3def1a082ef9a790a4a5820a431452524408a9d4229d6abc548c5e6efb24)
    
    Error opening media file buffer.
    open .git/lfs/objects/90/bd/90bd3def1a082ef9a790a4a5820a431452524408a9d4229d6abc548c5e6efb24-temp: file exists
    goroutine 1 [running]:
    github.com/github/git-lfs/lfs.Stack(0x0, 0x0, 0x0)
            /tmp/git-lfs/src/github.com/github/git-lfs/lfs/errors.go:85 +0x8d
    github.com/github/git-lfs/lfs.Errorf(0x7fa8f3bfb598, 0xc2081d5f20, 0x8335d0, 0x20, 0x0, 0x0, 0x0, 0x4f)
            /tmp/git-lfs/src/github.com/github/git-lfs/lfs/errors.go:29 +0x5e
    github.com/github/git-lfs/lfs.downloadFile(0x7fa8f3bf9c58, 0xc20802e008, 0xc20803c3c0, 0x7fffbec09550, 0x38, 0xc208050e40, 0x57, 0x0, 0x0)
            /tmp/git-lfs/src/github.com/github/git-lfs/lfs/pointer_smudge.go:128 +0x46a
    github.com/github/git-lfs/lfs.PointerSmudge(0x7fa8f3bf9c58, 0xc20802e008, 0xc20803c3c0, 0x7fffbec09550, 0x38, 0x0, 0x0, 0x0)
            /tmp/git-lfs/src/github.com/github/git-lfs/lfs/pointer_smudge.go:32 +0x37a
    github.com/github/git-lfs/lfs.(*Pointer).Smudge(0xc20803c3c0, 0x7fa8f3bf9c58, 0xc20802e008, 0x7fffbec09550, 0x38, 0x0, 0x0, 0x0)
            /tmp/git-lfs/src/github.com/github/git-lfs/lfs/pointer.go:44 +0x6f
    github.com/github/git-lfs/commands.smudgeCommand(0x9b2ca0, 0xc20802ae50, 0x1, 0x1)
            /tmp/git-lfs/src/github.com/github/git-lfs/commands/command_smudge.go:60 +0x9ce
    github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).execute(0x9b2ca0, 0xc20802ae40, 0x1, 0x1, 0x0, 0x0)
            /tmp/git-lfs/src/github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra/command.go:355 +0x189
    github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).findAndExecute(0x9b32a0, 0xc20800a010, 0x2, 0x2, 0x0, 0x0)
            /tmp/git-lfs/src/github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra/command.go:334 +0xd4
    github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).Execute(0x9b32a0, 0x0, 0x0)
            /tmp/git-lfs/src/github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra/command.go:408 +0x8ad
    github.com/github/git-lfs/commands.Run()
            /tmp/git-lfs/src/github.com/github/git-lfs/commands/commands.go:84 +0x2a
    main.main()
            /tmp/git-lfs/git-lfs.go:9 +0x1b
    
    

    It happens in windows and Linux, when I Ctrl+C mid transfer or when the transfer fails due to poor internet/timeout. I'm using an external https lfs repo. (running the lfs test server)

  3. technoweenie commented on Jul 18, 2015

    @technoweenie
    ContributorAuthor

    Clearly my "fix" was only a partial solution :feelsgood:

    What are the file sizes of .git/lfs/objects/90/bd/90bd3def1a082ef9a790a4a5820a431452524408a9d4229d6abc548c5e6efb24-temp and .git/lfs/objects/90/bd/90bd3def1a082ef9a790a4a5820a431452524408a9d4229d6abc548c5e6efb24`?

    This part of the code base has been on my mind while discussing the extensions proposal (#444).

  4. andyneff commented on Jul 22, 2015

    @andyneff
    Contributor

    In the test I ran (and broke via Ctrl+C)
    .git/lfs/objects/90/bd/90bd3def1a082ef9a790a4a5820a431452524408a9d4229d6abc548c5e6efb24-temp is zero bytes
    and git/lfs/objects/90/bd/90bd3def1a082ef9a790a4a5820a431452524408a9d4229d6abc548c5e6efb24 does not exist

    I'm not sure I've ever seen the -temp not zero bytes, but I was not looking every time. I'm fairly certain the non-temp file is always missing.

  5. alexlouden commented on Oct 6, 2015

    @alexlouden

    👍 same issue here

    $ git lfs fetch   
    Fetching master
    (44 of 44 files) 572.00 MB / 1.94 GB                                                                                                                                                
    Error opening media file buffer.
    Error opening media file buffer.
    Error opening media file buffer.
    

    Now every git lfs pull gives me this error, and doesn't resume downloading.

    $ find .git/lfs/objects/ -name '*-temp'
    .git/lfs/objects//48/6a/486af52b702c6d888c3da6eba62ed73d21efebeb187f63ce701ef05de036d36c-temp
    .git/lfs/objects//52/79/5279bc159b72b7445d8aae5f289d24bb4042c35422ef32da68049d8f666d3ff5-temp
    .git/lfs/objects//85/ab/85ab28abe9defc2838839969b31aea647e0de34615fbfed3ba716205de365d0a-temp
    

    I then deleted the files (find .git/lfs/objects/ -name '*-temp' -delete) and it's pulling the remainder.

    Using latest git-lfs: git-lfs/1.0.0 (GitHub; darwin amd64; go 1.5.1)

  6. javenfang commented on Oct 9, 2015

    @javenfang

    Same issue I encountered. Any update ?

  7. technoweenie commented on Oct 20, 2015

    @technoweenie
    ContributorAuthor

    Here's an attempt to fix this for real: #763

  8. loretoparisi commented on Nov 23, 2016

    @loretoparisi

    I have the same issue on

    git-lfs/1.0.0 (GitHub; darwin amd64; go 1.5.1; git 7379fa9)
    

    macOS Sierra 10.12.11

    I get

    $ git lfs pull
    (3 of 12 files) 0 B / 195.28 MB                                                                                                                                                                 
    Error opening media file buffer.
    

    doing

    $ find .git/lfs/objects/ -name '*-temp' -delete
    $ git lfs pull
    (0 of 12 files) 1.74 MB / 195.28 MB                                
    

    it partially fixes it.

    Of course this happens in case of networks with high latency / bandwidth temporary constraints etc.

  9. ttaylorr commented on Nov 28, 2016

    @ttaylorr
    Contributor

    @loretoparisi this is a closed issue, but I'm happy to help out 👋

    I have the same issue on

    git-lfs/1.0.0 (GitHub; darwin amd64; go 1.5.1; git 7379fa9)
    

    This is a pretty outdated version of Git LFS (and Go). We've introduced a number of new features and bug fixes since LFS v1.0.0, which you can take advantage of by running:

    $ brew update
    $ brew upgrade go git-lfs

    Of course this happens in case of networks with high latency / bandwidth temporary constraints etc.

    We also added a new option to process extra retries for objects that have failed (as is common in the types of situations you're describing). You can try:

    $ git config lfs.transfer.maxretries 16
  10. Zibri commented on May 15, 2024

    @Zibri

    I can't resume a download (huge) from huggingface...
    I tried all the above.. if I press cobntrol C it starts from the start...
    also.. I added aria2 in git configuration but it seems it's not using it.

  11. bk2204 commented on May 15, 2024

    @bk2204
    Member

    Hey,

    This is a closed issue, and a very old one at that. We have full support for resuming if the server also supports it. If you're still seeing a problem, please open a new issue, filling out the issue template, including the trace output requested and the output of git lfs env. Please also explain what you added to the Git configuration (by naming the specific options you inserted or command you ran), and include the output of git config -l --show-origin.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions