Git development
 help / color / mirror / Atom feed
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 16:45:13 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0812101636351.3340@localhost.localdomain> (raw)
In-Reply-To: <1228955062.27061.36.camel@starfruit.local>



On Wed, 10 Dec 2008, R. Tyler Ballance wrote:
>
> The stack size is 8M as you assumed, I'm curious as to how the kernel
> handles a process that exceeds the ulimit(2) stacksize. I know from our
> experience with this repository that when Git runs up against the
> address space (ulimit -v) that an ENOMEM or something similar is
> returned. Is there an E_NOSTACK? :) (figured I'd ask, given your
> apparent knowledge on the subject ;))

Since stack expansion doesn't involve any system calls, and since there is 
no way to recover from it anyway, the kernel has no choice: it just sends 
a SIGSEGV.

An application that wants to _can_ handle this case by installing a signal 
handler, but since signal handling needs some stack-space too, a regular 
"sigaction(SIGSEGV..)" isn't sufficient. You also need to set up a 
separate signal stack ..

Nobody really ever does that, except for some _really_ special programs. 
But it's a way to handle errors in stack allocation if you really need to. 
Git certainly does not do it.

> > (You can do something like
> > 
> > 	git rev-list --first-parent HEAD | wc -l
> 
> tyler@ccnet:~/source/slide/brian_main>  git rev-list --first-parent HEAD | wc -l
> 46751 

Ahh. yes. The 80k number is because the callchain was that deep, but since 
each recursion involves _two_ functions, it really only needed a 40k 
commit depth to the root to get there.

> > 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.
> 
> Given that this issue affects our internal (proprietary) repository, I
> can't very well give access to it or publish a clone, but I'm willing to
> help in any way I can. We maintain an internal fork of the Git tree, so
> I can apply any changes you'd like to an internal 1.6.0.4 or 1.6.0.5
> build. For obvious reasons I ran the fsck against an upstream maintained
> (stable) build of Git.

Can you try with a bigger stack? Just do

	ulimit -s 16384

and then re-try the fsck. Just to verify that this is it. If nothing else, 
it will at least give you a working fsck, even if it's obviously not the 
"correct" solution.

		Linus

  reply	other threads:[~2008-12-11  0:47 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
2008-12-11  0:24           ` R. Tyler Ballance
2008-12-11  0:45             ` Linus Torvalds [this message]
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.0812101636351.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