Re: git gc gives "error: Could not read..."

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 01.06.2015 um 10:14 schrieb Jeff King:
> On Mon, Jun 01, 2015 at 09:37:17AM +0200, Stefan Näwe wrote:
> 
>> One of my repos started giving an error on 'git gc' recently:
>>
>>  $ git gc
>>  error: Could not read 7713c3b1e9ea2dd9126244697389e4000bb39d85
>>  Counting objects: 3052, done.
>>  Delta compression using up to 4 threads.
>>  Compressing objects: 100% (531/531), done.
>>  Writing objects: 100% (3052/3052), done.
>>  Total 3052 (delta 2504), reused 3052 (delta 2504)
>>  error: Could not read 7713c3b1e9ea2dd9126244697389e4000bb39d85
> 
> The only error string that matches that is the one in parse_commit(),
> when we fail to read the object. It happens twice here because
> `git gc` runs several subcommands; you can see which ones are generating
> the error if you run with GIT_TRACE=1.
> 
> I am surprised that it doesn't cause the commands to abort, though. If
> we are traversing the object graph to repack, for example, we would want
> to abort if we are missing a reachable object (i.e., the repository is
> corrupt).
> 
>> I tried:
>>
>>  $ git cat-file -t 7713c3b1e9ea2dd9126244
>>  fatal: Not a valid object name 7713c3b1e9ea2dd9126244
> 
> Not surprising, if we don't have the object. What is curious is why git
> wants to look it up in the first place. I.e., who is referencing it?
> 
> Either:
> 
>   1. It is an object that we are OK to be missing (e.g., the
>      UNINTERESTING side of a traversal), and the error should be
>      suppressed.
> 
>   2. Your repository really is corrupted, and this is a case where we
>      need to be paying attention to the return value of parse_commit but
>      are not.
> 
> I'd love to see:
> 
>   - the output of "GIT_TRACE=1 git gc" (to see which subcommand is
>     causing the error)
> 
>   - the output of "git fsck" (which should hopefully confirm whether or
>     not there is a real problem)

See attached file.

>   - any mentions of the sha1 in the refs or reflogs. Something like:
> 
>       sha1=7713c3b1e9ea2dd9126244697389e4000bb39d85
>       cd .git
>       grep $sha1 $(find packed-refs refs logs -type f)

That gives nothing.

>   - If that doesn't turn up any hits, then presumably it's an object
>     referencing the sha1. We can dig into the objects (all of them, not
>     just reachable ones), like:
> 
>       {
>         # loose objects
>         (cd .git/objects && find ?? -type f | tr -d /)
>         # packed objects
>         for i in .git/objects/pack/*.idx; do
>           git show-index <$i
>         done | cut -d' ' -f2
>       } |
>       # omit blobs; they are expensive to access and cannot have
>       # reachability pointers
>       git cat-file --batch-check='%(objecttype) %(objectname)' |
>       grep -v ^blob |
>       cut -d' ' -f2 |
>       # now get all of the contents, and look for our object; this is
>       # going to be slow, since it's one process per object; but we
>       # can't use --batch because we need to pretty-print the trees
>       xargs -n1 git cat-file -p |
>       less +/$sha1

Turns out to be a tree:

tree 7713c3b1e9ea2dd9126244697389e4000bb39d85
parent d7acfc22fbc0fba467d82f41c90aab7d61f8d751
author Stefan Naewe <stefan.naewe@xxxxxxxxxxxxxxxxxxxx> 1429536806 +0200
committer Stefan Naewe <stefan.naewe@xxxxxxxxxxxxxxxxxxxx> 1429536806 +0200


> I would have guessed this was maybe caused by trying to traverse
> unreachable recent objects for reachability. It fits case 1 (it is OK
> for us to be missing these objects, but we might accidentally complain),
> and it would probably happen twice during a gc (once for the repack, and
> once for `git prune`).
> 
> But that code should not be present in older versions of msysgit, as it
> came in v2.2.0 (and I assume "older msysgit is v1.9.5). 

Not exactly. My msysgit is merge-rebase'd (or rebase-merge'd...) onto v2.2.0...
I'll try older versions (pre v2.2.0) on linux.

> And if that is
> the problem, it would follow a copy of the repo, but not a clone (though
> I guess if your clone was on the local filesystem, we blindly hardlink
> the objects, so it might follow there).

I also cloned from local filesystem (widnows drive) to a samba share.

Thanks,
  Stefan
-- 
----------------------------------------------------------------
/dev/random says: Useless Invention: How-to cassettes for the deaf.
python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')" 
GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9  9666 829B 49C5 9221 27AF
$ GIT_TRACE=1 git gc
10:21:27.228845 git.c:348               trace: built-in: git 'gc'
10:21:27.228845 run-command.c:347       trace: run_command: 'pack-refs' '--all' '--prune'
10:21:27.244445 git.c:348               trace: built-in: git 'pack-refs' '--all' '--prune'
10:21:27.260045 run-command.c:347       trace: run_command: 'reflog' 'expire' '--all'
10:21:27.275646 git.c:348               trace: built-in: git 'reflog' 'expire' '--all'
10:21:27.338047 run-command.c:347       trace: run_command: 'repack' '-d' '-l' '-A' '--unpack-unreachable=2.weeks.ago'
10:21:27.353647 git.c:348               trace: built-in: git 'repack' '-d' '-l' '-A' '--unpack-unreachable=2.weeks.ago'
10:21:27.353647 run-command.c:347       trace: run_command: 'pack-objects' '--keep-true-parents' '--honor-pack-keep' '--non-empty' '--all' '--reflog' '--indexed-objects' '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset' '.git/objects/pack/.tmp-3852-pack'
10:21:27.384848 git.c:348               trace: built-in: git 'pack-objects' '--keep-true-parents' '--honor-pack-keep' '--non-empty' '--all' '--reflog' '--indexed-objects' '--unpack-unreachable=2.weeks.ago' '--local' '--delta-base-offset' '.git/objects/pack/.tmp-3852-pack'
error: Could not read 7713c3b1e9ea2dd9126244697389e4000bb39d85
10:21:27.915258 run-command.c:347       trace: run_command: 'prune' '--expire' '2.weeks.ago'
10:21:27.930858 git.c:348               trace: built-in: git 'prune' '--expire' '2.weeks.ago'
error: Could not read 7713c3b1e9ea2dd9126244697389e4000bb39d85
10:21:28.196063 run-command.c:347       trace: run_command: 'rerere' 'gc'
10:21:28.211664 git.c:348               trace: built-in: git 'rerere' 'gc'
$ -----------------------------------------------------------------------------
$ git fsck
dangling commit 8a0066c756e13e5f8b02fdab4716bff74de7556e
dangling commit 450111131bb54c2a7426c7c4d07729d96a3a4b08
dangling blob e6c1f0b06d7c2571f27885efb722628a5640f5bb
dangling blob ad026f17ef3ca76c8e6a176b0e9c161820cb55bd
dangling commit bb828e3aea9cd8ca472b7bf84175c2d786c6bca6
dangling blob cf82a18977b340e8d52f0e7d5a27cc95de79083e
dangling commit e822f5fd21cb7c0523d73474d7fd5f7038c53323
dangling blob 132355dd750c3425f566db4df93d11dd5713ee57
dangling blob 3ba352808438fbcb937efbfe297572e5629622be
dangling blob 3f6315e9789309b0b608e130d863b99bbf479ea4
dangling commit 902399eb3d16606940c373340ab287693981094d
dangling blob d6c30db3396fd157f9051068f85e57b9c0eec5d6
dangling blob 3344fa068975a3b5f8bbb00161367fd5cfe75c56
dangling blob 5ea460158d22979898e8c72650c98074d3f9f9d7
dangling blob dd247bd0e183903e80c634e3d97d757902c19829
dangling commit 78859135a46bbde0bfd54add4138d6492cf1509a
dangling blob 84e5b7254a52115ade3f11fcdc39ad3d9480af5a
dangling blob b085bbf3b6a3021fd28ff54f102aef90bae41ffb
dangling blob dac51e999c3820142c4b7ecffc7a8249e1d83c31
dangling commit 8ae6f24c2f6f1e0494a95020131d7c326bc74a4d
dangling blob 93a6270236e39959b4e1a1bb4996a49819bd8bb8
dangling blob 7ee7c42e98e64a253e5183b7a0fb0d5fe8ac62d4
dangling blob a1e7795049e459db59cb897422d6b5b9284f02c4
dangling commit 1508fa2bb1beba32ce97d9fe52ba41f162cd2a52
dangling blob 35e85b19da57331a6dff5da3f98dbcba00b1f5cf
dangling commit 3d8856caf448bf6fd8f255531cd242e937cfe60e
dangling blob 88e898403686622bee2f5a56e1dcabd3f3e76d7f
dangling commit fb68819d653555456a1c8a69adfed59b8714fdcb
dangling commit 66095370ee7c01f97e55bbafb46173d46324d566
dangling blob 7109dbbb65382961bad78e96e759dc10c6089893
dangling blob 432a66e07bc0c72b11666ca428e4c144664b8d9d
dangling commit ae4a91c13b448c1e0df3ea5a490eaadd295b775d
dangling blob 212bcc5073d3f15d554c57c586607b176999fa6e
dangling blob 374b9ffcec1d3c0526ac280b3e23019995577229
dangling blob 75abddbc662d2ad4116cfd1d1b4652a28cdf7516
dangling commit 136c216120c7c6d562e67ef6a26e118f3d377d75
dangling blob b48c13bf7ab920fe9d6dae3dd4960616e146e2c4
dangling blob 12cd4bf13c90918841acde16a84c129f4fe4c1cb
dangling blob 448e6eca0bdd9070628fe98a3b13af3542eeb190
dangling blob af8e10f66a96920f9caf7abc7e778a8ed25b7e7f
dangling blob 2f2fe720093863e455fd350982d22013268db4ab
dangling blob 786fd76d6e90bd0f812685bcf21308f469cff806
dangling commit b8cf8a7c3382ae243e3691de437c179f6fe5b109
dangling commit deef19eb8b606899d18a77e5671569ee422e5c74
dangling blob c01002da12138b843efc3794ae057828d57713ff
dangling blob 6e31e31e214628f5cfb208b09f4c8cb6e0a7efd7
dangling commit c01168eb4f10937347035388e82c34b36b5e757a
dangling commit c5f1e1f2a04bd46f0f0017be6dbfe39170dacd37
dangling commit c671700332dac70cb8f02b49d49085635db829b7
dangling commit c7b16704a89c5e6dff26251c5c3c3596643a4765
dangling blob 13d2cdca94567550f5720d7271404d5cf1465b76
dangling blob 7a9216bd39c0249267da24e374b93b0bef7bab3a
dangling blob e272943ad649011749d99a102f75cbb2cfe0481c
dangling blob e412a8d9f91ac5ab621c607e9e79dd070f0575ea
dangling blob 15d3e1c23d11963494f1fddffdfbe8d82281ebe7
dangling blob dcb3ece673bd71b2a7cd797863ab05b9f55d982a
dangling blob e893edce44198fc3ed7d2a0a800addb9f7fcdd00
dangling commit 2c74dba4cb87622bf281fea95495580ed7169f7f
dangling commit 38349ee95d761badfb6ef86899744ffa7aa6dc4d
dangling commit 3b348f3eae0e14cdaf792ea11334f1ea20b8ac21
dangling commit 5874ff569260833b7da14565c9a04172f45bea34
dangling blob 86d47d16d7cf6b460ff7f2d821845add385b168a
dangling blob 8e14d0376ae4c963654038ab8552c14a88c82f19
dangling commit 9674dae0470e1659d08d7258fc87ccb65469c377
dangling commit a894434804e644d52f18eac6564b5470c355a0fd
dangling commit fdf458b7ffa6f81038988818f6bdb148ddbd2747
dangling blob 1a154456fd202678d09c8fe3488a7ff5eb128f0e
dangling commit 315500c96a705a19bda551b552bb4af76a5423b9
dangling blob 35d541a16983732fb33205711a4ae275659f35bf
dangling blob a7354d59cd449515daf1da563d4a81b0511e43f7
dangling commit bfb5538171c1a00a09b979005a032400b8be6c11
dangling blob da35f034d130a0d5a7864b243e919c2885af7dcb
dangling commit 25365b87e74792bd278afec51afdfc74ef378301
dangling blob 9f36254fdae6ed8e543d8ada1dfeb7273322421f
dangling commit 82375e755bebab8b4a5c34cc227fdfbcaf587878
dangling commit 1f78f76aeb42cdd5e7dd5201eb46f11b1794b959
dangling commit 4418d11dc76a4eb0327c2f182c40584774f1fa27
dangling commit 925850b1e58b665bd5df508eb7cb99eedae8b472
dangling commit a138760e4b7c324fd54e52998ab19ed4c4106064
dangling blob de788db974ca67606102f301cbc9926a55e1d9a2
dangling blob 0d7943f697e316b9d97ff89b0efc341425205426
dangling commit 0e999989958b7b7a9e5718500bc0d2122e5155ac
dangling blob 2d59c05f686f88684c65359e2af46b0a2e2c1385
dangling blob 96591f7dc1e9f6d1b540884c2201da25b4435611
dangling blob b239ff3b282c9d45d5e901835f217dc28b949b32
dangling blob df7968cdc5d56584641f611f6f907727048d72cf
dangling blob 1f5a1377e8f920e9392696f1187886b85a65c794
dangling blob 49fbe34371c0ddd391f35ec05c5e6b9166016fa1
dangling blob 599bdfe5070788fc301d3002ee3973383d0b6cf9
dangling commit 5a3b29c6cf9a62252e607d2a367402549b981b67
dangling blob 1edc5a3c2de4a883e0b959a663727bff691707af
dangling blob 81fc0a7f742d6c9c629d22fc3a8eccfc631f2165
dangling commit 3e7ddd2f7b25d6422a6baae129cc4c2a1be09728
dangling blob 90dd4cf5ae9c6d9b8eefff04099ec76093622738
dangling blob 9b3ddb9a8e5ac2adbf0f2c3b40e9c93f95b3770d
dangling commit e67d527c84eeb095ab8a627cc0d369e49708af1b
dangling blob 061e173ee667f82b952f57998fc7666420cbeca5
dangling commit 3bbef5a498d6fbfe34a5f06828da1f9b1f26990d
dangling commit 6e7e6d49490c88a3c974f80baa94a505453b3b87
dangling blob 87be2bcf0238fc64671dfb4d3c56b5116f8e0939
dangling commit 8fde9bf8b855191936f565f8ce1207da4ff7f70f
dangling blob 967e88babd993b76f9e03916beb28c2bea7accbd
dangling blob c6be8987d0adeac36a53691076950a68440e6b1e
dangling commit d59ed0675627b36d7ad836b810a3ede13cbdee17
dangling blob 48dff406c16f2aa182e0e22f87cd7a4bef600072
dangling commit 4adf7f23bba31cbb7b0628367c51aba0e68359c5
dangling blob 81ff52ca8932c6f5b64737b28e07a18af0056f38

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]