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

Re: [PATCH] git daemon: avoid calling syslog() from a signal handler

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 6, 2008, 01:42 UTC
Message-ID
<alpine.DEB.1.00.0807060337480.3557@eeepc-johanness>
In-Reply-To
<7vabgwtf6m.fsf@gitster.siamese.dyndns.org>
Hi,
On Sat, 5 Jul 2008, Junio C Hamano wrote:
Show 13 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> >> So you will check every 1ms to see if there are new dead children, 
> >> but why is this necessary?
> >
> > This comes from me not reading the man page for poll() properly.  Of 
> > course, I want to check every second: syslog timestamps the messages 
> > with a resolution of 1 second, AFAIR, or at least some of them do.
> 
> Hmm.
> 
> The question was not about the millisecond typo, but about why time-out 
> at all.
Because I do not want to change the semantics!

ATM, in those cases where it works (as opposed to hanging!), git-daemon --verbose reports in the syslog when a client disconnected, possibly with an error. It does so with a timestamp so that you can see how long the connection lasted. That is what logs are useful for.

Now, syslog has timestamps at second-resolution (at least here it does), and I wanted to imitate that.

The alternative would be to deprive all users of an (mostly) accurate timestamp of the disconnect time.

> Another way would be to set up a pipe to ourself that is included in the 
> poll() and write a byte to the pipe from the signal handler.

It still would need to break out of the poll(), in which case the effect would be _exactly_ the same, but with a lot of more trouble, and opportunities for me to bring in new bugs, right?

Ciao, Dscho

Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 13 in “Non-inetd git-daemon hangs in syslog(3)/fclose(3) if --syslog --verbose accessing non-repositories”
  1. Brian FosterJul 3, 2008
  2. Johannes SchindelinJul 3, 2008
  3. Brian FosterJul 3, 2008
  4. Johannes SchindelinJul 3, 2008
  5. git daemon: avoid calling syslog() from a signal handlerJohannes Schindelin, Jul 3, 2008
  6. Junio C HamanoJul 5, 2008
  7. Johannes SchindelinJul 5, 2008
  8. Junio C HamanoJul 5, 2008
  9. Johannes SchindelinJul 6, 2008
  10. Junio C HamanoJul 6, 2008
  11. git daemon: avoid calling syslog() from a signal handlerJohannes Schindelin, Jul 6, 2008
  12. Junio C HamanoJul 7, 2008
  13. Stephen R. van den BergJul 7, 2008

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.