From: Junio C Hamano <gitster@pobox•com>
To: mkoegler@auto•tuwien.ac.at (Martin Koegler)
Cc: Nicolas Pitre <nico@cam•org>, Simon Hausmann <simon@lst•de>,
Git Mailing List <git@vger•kernel.org>
Subject: Re: git fsck segmentation fault
Date: Wed, 10 Dec 2008 18:33:20 -0800 [thread overview]
Message-ID: <7vljunwidr.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20081210075338.GA7776@auto.tuwien.ac.at> (Martin Koegler's message of "Wed, 10 Dec 2008 08:53:38 +0100")
mkoegler@auto•tuwien.ac.at (Martin Koegler) writes:
> Maybe something like this could help:
>>From 32be177cbb0825fc019200b172f3d79117b28140 Mon Sep 17 00:00:00 2001
> From: Martin Koegler <mkoegler@auto•tuwien.ac.at>
> Date: Wed, 10 Dec 2008 08:42:08 +0100
> Subject: [PATCH] fsck: use fewer stack
>
> This patch moves the state while traversing the tree
> from the stack to the heap.
Hmm, after the change:
* mark_object() marks the object as reachable, and pushes the
objects to the objectstack;
* mark_object_reachable() marks the object using mark_object(),
and repeatedly calls mark_child_object() until the objectstack
is fully drained;
* mark_child_object() inspects the object taken from the
objectstack, calls fsck_walk() on it, with mark_object as the
callback;
* fsck_walk() calls the callback function (i.e. mark_object) on
the object given, and the objects immediately reachable from
it;
* mark_object() does not recurse, so these immediately
reachable objects are left in the objectstack, without a
deep recursion.
That seems to be what is going on, and this should be a good fix.
A similar change would be needed for other callers of fsck_walk(), no?
There seem to be one in builtin-unpack-objects.c (check_object calls
fsck_walk as itself as the callback).
Another caller is in index-pack.c (sha1_object() calls fsck_walk with
mark_link as the callback), but I do not think it would recurse for the
depth of the history, so we are safe there.
I initially expected that the fix would be to introduce this "userspace
work queue" (i.e. your objectstack) to be maintained on the
fsck.c:fsck_walk() side (perhaps as an extra parameter to an actual queue
for reentrancy), not by making the callee not to recurse, though.
next prev parent reply other threads:[~2008-12-11 2:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-27 17:14 git fsck segmentation fault Simon Hausmann
2008-11-27 17:47 ` Nicolas Pitre
2008-11-27 19:10 ` Simon Hausmann
2008-11-27 19:21 ` Simon Hausmann
2008-11-27 19:57 ` Nicolas Pitre
2008-11-28 8:19 ` Simon Hausmann
2008-12-09 19:09 ` Nicolas Pitre
2008-12-09 21:57 ` Martin Koegler
2008-12-10 7:53 ` Martin Koegler
2008-12-11 2:33 ` Junio C Hamano [this message]
2008-12-11 6:27 ` Martin Koegler
2008-12-11 6:42 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vljunwidr.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=mkoegler@auto$(echo .)tuwien.ac.at \
--cc=nico@cam$(echo .)org \
--cc=simon@lst$(echo .)de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox