Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 599008 - sys-apps/portage-9999: occasional git gc failures due to too many unreachable loose objects
Summary: sys-apps/portage-9999: occasional git gc failures due to too many unreachable...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 552814 659322
  Show dependency tree
 
Reported: 2016-11-05 17:34 UTC by Coacher
Modified: 2023-05-18 22:55 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info portage (info,7.27 KB, text/plain)
2016-11-05 17:34 UTC, Coacher
Details
/etc/portage/repos.conf/gentoo.conf (gentoo.conf,150 bytes, text/plain)
2016-11-05 17:35 UTC, Coacher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Coacher 2016-11-05 17:34:04 UTC
Created attachment 452446 [details]
emerge --info portage

Hello.

I occasionally see the following problem during 'emerge --sync':
>>> Syncing repository 'gentoo' into '/var/portage'...
/usr/bin/git fetch origin --depth 1
remote: Counting objects: 16, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 16 (delta 12), reused 13 (delta 9), pack-reused 0
Unpacking objects: 100% (16/16), done.
From https://github.com/gentoo-mirror/gentoo
 + 7a9417b...8483dac master     -> origin/master  (forced update)
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
error: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

=== Sync completed for gentoo
q: Updating ebuild cache in /var/portage ...
q: Finished 39720 entries in 0.556075 seconds

This happens almost every time git-gc automatically kicks in.
I can easily fix the problem locally, but I hope it can be avoided at all.

I usually don't manually touch that repo, only portage touches that. Of course I have to touch it manually to resolve the problem seen above, but that's it.

My portage is master @ d075422a, but I've seen this problem with earlier revisions as well.

Please fix.
Comment 1 Coacher 2016-11-05 17:35:21 UTC
Created attachment 452448 [details]
/etc/portage/repos.conf/gentoo.conf
Comment 2 Oleh 2016-11-05 18:39:13 UTC
guess, that git fetch --depth=1 has to be reconsidered as gitcmd used by default during sync. doing shallow fetches each sync is a broken concept. it only needed for initial clone. using git pull is a way to go each sync and without --depth=1. originally, when this implemented, it served only for clone of repo, when it's not exist. there is no evident performance, bandwidth savings with this and instead lot of artifacts people have here and there.
Comment 4 Zac Medico gentoo-dev 2016-11-06 18:53:57 UTC
(In reply to Oleg from comment #2)
> doing shallow fetches each sync is a broken concept.

It might be feasible, but inideed it seems that git support is not good enough for it to be a practical default at this time.
Comment 5 Larry the Git Cow gentoo-dev 2018-07-11 06:19:18 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=903c4b1a67689c4b8cc59113a56d58575cf7db8e

commit 903c4b1a67689c4b8cc59113a56d58575cf7db8e
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-07-10 07:03:35 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-07-11 06:10:41 +0000

    GitSync: support sync-depth (bug 552814)
    
    Support sync-depth for shallow sync, using git reset --merge just
    like in the earlier implementation that was reverted in commit
    ab840ac982d3c8b676b89f6bedd14e85dd06870f. Also, run git gc --auto
    in the foreground, in order to trigger periodic housekeeping and
    hopefully avoid errors from automatic git gc calls as reported in
    bug 599008.
    
    The default sync-depth is unlimited, which means that default
    behavior remains unchanged (unlike the previous implementation that
    was reverted).
    
    Bug: https://bugs.gentoo.org/552814
    Bug: https://bugs.gentoo.org/599008

 man/portage.5                       |  3 ++-
 pym/portage/repository/config.py    |  4 ----
 pym/portage/sync/modules/git/git.py | 26 +++++++++++++++++++++++++-
 3 files changed, 27 insertions(+), 6 deletions(-)
Comment 6 Zac Medico gentoo-dev 2018-07-11 06:28:30 UTC
(In reply to Larry the Git Cow from comment #5)
> The bug has been referenced in the following commit(s):
> 
> https://gitweb.gentoo.org/proj/portage.git/commit/
> ?id=903c4b1a67689c4b8cc59113a56d58575cf7db8e

I've made it run the garbage collection in the foreground as follows, so that anything that really requires intervention should be immediately visible:

   git -c gc.autodetach=false gc --auto