git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git fast-import crashing on big imports

From
USUlrich Spörlein <uqs@freebsd.org>
Date
Jan 19, 2017, 14:03 UTC
Message-ID
<CAJ9axoT1pUQc_jTKxO+RMw7emhA4ss1NCAU+hpnyG5LMwGD89w@mail.gmail.com>
In-Reply-To
<20170118215120.6hle2uxgkcvvtlox@sigill.intra.peff.net>
2017-01-18 22:51 GMT+01:00 Jeff King <peff@peff.net>:
Show 11 quoted lines
>
> On Wed, Jan 18, 2017 at 03:27:04PM -0500, Jeff King wrote:
>
> > On Wed, Jan 18, 2017 at 09:20:07PM +0100, Ulrich Spörlein wrote:
> >
> > > I found your commit via bisect in case you were wondering. Thanks for
> > > picking this up.
> >
> > Still downloading. However, just looking at the code, the obvious
> > culprit would be clear_delta_base_cache(), which is called from
> > literally nowhere except fast-import, and then only when checkpointing.
Sorry for the bad URL, pesky last minute changes ...
Show 10 quoted lines
> Hmm. I haven't reproduced your exact issue, but I was able to produce
> some hijinks in that function.
>
> The problem is that the hashmap_iter interface is unreliable if entries
> are added or removed from the map during the iteration.
>
> I suspect the patch below may fix things for you. It works around it by
> walking over the lru list (either is fine, as they both contain all
> entries, and since we're clearing everything, we don't care about the
> order).

Confirmed. With the patch applied, I can import the whole 55G in one go without any crashes or aborts. Thanks much!

Show 33 quoted lines
>
> ---
>  sha1_file.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/sha1_file.c b/sha1_file.c
> index 1eb47f611..d20714d6b 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -2342,11 +2342,10 @@ static inline void release_delta_base_cache(struct delta_base_cache_entry *ent)
>
>  void clear_delta_base_cache(void)
>  {
> -       struct hashmap_iter iter;
> -       struct delta_base_cache_entry *entry;
> -       for (entry = hashmap_iter_first(&delta_base_cache, &iter);
> -            entry;
> -            entry = hashmap_iter_next(&iter)) {
> +       struct list_head *lru, *tmp;
> +       list_for_each_safe(lru, tmp, &delta_base_cache_lru) {
> +               struct delta_base_cache_entry *entry =
> +                       list_entry(lru, struct delta_base_cache_entry, lru);
>                 release_delta_base_cache(entry);
>         }
>  }
> --
> 2.11.0.698.gd6b48ab4c
>
>
>
>
> >
> > -Peff
Previous: Jeff KingNext: Jeff King
Message 7 of 9 in “git fast-import crashing on big imports”
  1. Ulrich SpörleinJan 12, 2017
  2. Ulrich SpoerleinJan 18, 2017
  3. Jeff KingJan 18, 2017
  4. Jeff KingJan 18, 2017
  5. Jeff KingJan 18, 2017
  6. Jeff KingJan 18, 2017
  7. Ulrich SpörleinJan 19, 2017
  8. clear_delta_base_cache(): don't modify hashmap while iteratingJeff King, Jan 19, 2017
  9. Junio C HamanoJan 19, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.