From: Linus Torvalds <torvalds@linux-foundation.org>
To: "R. Tyler Ballance" <tyler@slide.com>
Cc: Johannes Sixt <j.sixt@viscovery.net>,
Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org
Subject: Re: epic fsck SIGSEGV! (was Recovering from epic fail (deleted .git/objects/pack))
Date: Wed, 10 Dec 2008 15:40:28 -0800 (PST) [thread overview]
Message-ID: <alpine.LFD.2.00.0812101523570.3340@localhost.localdomain> (raw)
In-Reply-To: <1228949523.27061.20.camel@starfruit.local>
On Wed, 10 Dec 2008, R. Tyler Ballance wrote:
>
> I decided to endure the 30 minutes long this took on machine, and ran
> the operation in gdb. As a result, I got the SIGSEGV again, and a 13MB
> stacktrace.
>
> In fact, the stack trace was probably longer, but this happened while I
> printed out `bt full`:
Wow. You even got _gdb_ to segfault.
You're my hero. If it can break, you will do it.
> I think I'm going to need to have a drink :-/
Have one for me too.
Anyway, that's a really annoying problem, and it's a bug in git.
Admittedly it's probably brought on by you having a fairly small stack
ulimit, which is also what likely brought gdb to its knees.
That stupid fsck commit walker walks the parents recursively. That's
horribly bogus. So you have a recursion that goes from the top-level
commit all the way to the root, doing
fsck_walk_commit -> walk(parent) -> fsck_walk-commit -> ..
and you have a fairly deep commit tree.
When it hits parent number 80,000+, you run out of stack space, and
SIGSEGV. And judging by the fact that gdb also SIGSEGV's for you when
doing the backtrace, it looks like the gdb backtrace tracer is _also_
recursive, and _also_ hits the same issue ;)
Anyway, with a 8M stack-size I can fsck the kernel repo without any
problem, but while the kernel repo has something like 120k commits in it,
it's a very "bushy" repository (lots of parallelism and merges), and the
path from the top parent to the root is actually much shorter, at just 27k
commits.
I take it that your project has a very long and linear history, which is
why you have a long path from your HEAD to your root.
(You can do something like
git rev-list --first-parent HEAD | wc -l
to get the depth of your history when just walking the first parent, and
if I'm right you'll have a number that is bgger then 80k.)
So you have definitely found a real bug. Right now, you should be able to
work around it by just making your stack depth rather bigger. The
recursion is not very complicated, so even though it's 80,000 deep, each
entry probably is about a hundred bytes on the stack.
In fact, if you're on Linux, most default stack depths would be 8 MB,
which would roughly match that "80k entries of 100 bytes each".
But we should definitely fix this braindamage in fsck. Rather than
recursively walk the commits, we should add them to a commit list and just
walk the list iteratively.
Junio?
Linus
next prev parent reply other threads:[~2008-12-10 23:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-10 0:11 Recovering from epic fail (deleted .git/objects/pack) R. Tyler Ballance
2008-12-10 0:19 ` Junio C Hamano
2008-12-10 10:06 ` R. Tyler Ballance
2008-12-10 11:39 ` Johannes Sixt
2008-12-10 22:52 ` epic fsck SIGSEGV! (was Recovering from epic fail (deleted .git/objects/pack)) R. Tyler Ballance
2008-12-10 23:40 ` Linus Torvalds [this message]
2008-12-11 0:24 ` R. Tyler Ballance
2008-12-11 0:45 ` Linus Torvalds
2008-12-11 1:21 ` R. Tyler Ballance
2008-12-11 0:51 ` epic fsck SIGSEGV! Junio C Hamano
2008-12-11 1:03 ` epic fsck SIGSEGV! (was Recovering from epic fail (deleted .git/objects/pack)) Boyd Stephen Smith Jr.
2008-12-11 1:16 ` Shawn O. Pearce
2008-12-11 1:33 ` Nicolas Pitre
2008-12-11 1:52 ` epic fsck SIGSEGV! Junio C Hamano
2008-12-11 2:16 ` Nicolas Pitre
2008-12-11 3:28 ` epic fsck SIGSEGV! (was Recovering from epic fail (deleted .git/objects/pack)) Linus Torvalds
2008-12-11 3:44 ` Linus Torvalds
2008-12-11 7:33 ` epic fsck SIGSEGV! Junio C Hamano
2008-12-11 17:33 ` Linus Torvalds
2008-12-11 20:18 ` Linus Torvalds
2008-12-11 7:53 ` Junio C Hamano
2008-12-11 4:00 ` epic fsck SIGSEGV! (was Recovering from epic fail (deleted .git/objects/pack)) Boyd Stephen Smith Jr.
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=alpine.LFD.2.00.0812101523570.3340@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=tyler@slide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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