git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Brady Catherman <brady@catherman.org>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] http-backend: Don't infinite loop during die()
Date: Wed, 24 Mar 2010 13:06:58 -0700	[thread overview]
Message-ID: <20100324200658.GA22505@spearce.org> (raw)
In-Reply-To: <7vvdclk1y9.fsf@alter.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> 
> > If stdout has already been closed by the CGI and die() gets called,
> > the CGI will fail to write the "Status: 500 Internal Server Error" to
> > the pipe, which results in die() being called again (via safe_write).
> > This goes on in an infinite loop until the stack overflows and the
> > process is killed by SIGSEGV.
> >
> > Instead set a flag on the first die() invocation and perform no
> > action during recursive die() calls.  This way failures to write the
> > error messages to the stdout pipe do not result in an infinite loop.
> 
> Hmm.  I would need something like this on top, but there must be a better
> way.  Ideas?

Ick.

Just exit(0) if dead is true.  The *only* reason we would come back
into the die handler at this point is because we failed during the
die handler.  That recursive failure means we can't report the
errors, because that's all that was left once the dead variable
was set.

-- 
Shawn.

  reply	other threads:[~2010-03-24 20:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-22  6:52 git clone over smart-http hanging for just one repo Brady Catherman
2010-03-22 14:12 ` Shawn O. Pearce
2010-03-22 14:22 ` [PATCH] http-backend: Don't infinite loop during die() Shawn O. Pearce
2010-03-22 20:25   ` Junio C Hamano
2010-03-24 18:29   ` Junio C Hamano
2010-03-24 20:06     ` Shawn O. Pearce [this message]
2010-03-24 20:24       ` Nicolas Pitre
2010-03-24 20:25         ` Shawn Pearce
2010-03-24 21:37       ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100324200658.GA22505@spearce.org \
    --to=spearce@spearce.org \
    --cc=brady@catherman.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).