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

Re: git clone over smart-http hanging for just one repo.

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 22, 2010, 14:12 UTC
Message-ID
<20100322141230.GA8916@spearce.org>
In-Reply-To
<51569EE6-A926-45DB-A588-B659750BA643@catherman.org>
Brady Catherman <brady@catherman.org> wrote:
> I have a git repo that fails to clone or fetch over smart-http, but  
> works great over dav. I am wondering if somebody can help me debug the  
> issue since I am at a loss why this is happening.
Yea, I'm at a loss too. :-(
> The interesting parts of a strace of git-http-backend following a git  
> clone follow:
...
> 12037 close(1)                          = 0

Why did the CGI process just close stdout? I'm guessing this is part of the exec of the upload-pack child in the background. Oh, right, we closed it because we passed the descriptor to the child and now the parent CGI doesn't want it anymore.

> 12037 write(1, "Status: 500 Internal Server Error\r\n", 35) = -1 EBADF  
> (Bad file descriptor)

This smells like the backend upload-pack process got into trouble and exited early, so now the CGI is trying to change the status to 500 since the backend exited with a non-zero status. Only its too late, as the filedescriptor was already closed after the successful fork().

We're stuck in a loop because we're failing during the die routine.

Because the file descriptor is closed, safe_write() which was what originated that write(1, ...) above, tries to call die(). But that die() call invokes die_webcgi() which in turn tries to write that 500 error message again to 1. So this goes on a for a while...

> 12037 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
> 12037 +++ killed by SIGSEGV +++

and then we run out of stack space, due to too many recursions, and the process is aborted by a SIGSEGV.

> Anybody have any thoughts why this would happen or what can be done to  
> fix it?

A gdb trace or something of the upload-pack process would help. That appears to have also died and we don't know why. Its death is what contributed to the CGI crashing above.

I'll try to send a patch for this recursive crashing problem in the CGI.

-- 
Shawn.
Previous: Brady CathermanNext: Shawn O. Pearce
Message 2 of 9 in “git clone over smart-http hanging for just one repo.”
  1. Brady CathermanMar 22, 2010
  2. Shawn O. PearceMar 22, 2010
  3. http-backend: Don't infinite loop during die()Shawn O. Pearce, Mar 22, 2010
  4. Junio C HamanoMar 22, 2010
  5. Junio C HamanoMar 24, 2010
  6. Shawn O. PearceMar 24, 2010
  7. Nicolas PitreMar 24, 2010
  8. Shawn PearceMar 24, 2010
  9. Junio C HamanoMar 24, 2010

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.