All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Sigler <linux.kernel@free.fr>
To: "Luis Claudio R. Goncalves" <lclaudio@uudg.org>
Cc: linux-rt-users@vger.kernel.org
Subject: Re: syslog(3) blocks when local socket is full
Date: Wed, 14 Nov 2007 10:04:45 +0100	[thread overview]
Message-ID: <473ABA2D.6060009@free.fr> (raw)
In-Reply-To: <20071113171458.GP6086@unix.sh>

(You're using a weird quote character.)

Luis Claudio R. Goncalves wrote:

> I did some more testing, now with syslog turned off. The return code is
> always 0, the program runs to completion - without hanging or without
> waiting for any event. Turning syslog on, no singe log message from the
> test program appears.
> 
> strace:
> 
> 500 repetitions of:
> 
>  socket(PF_FILE, SOCK_DGRAM, 0)          = 3
>  fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
>  connect(3, {sa_family=AF_FILE, path="/dev/log"}, 110) = -1 ENOENT
>    (No such file or directory)
>  close(3)                                = 0

The /dev/log file does not exist because syslogd removed it.
(A process must bind that "address" for the file to exist.)
The program tries to connect, and fails, 500 times.

My description of the setup was incorrect.

#include <syslog.h>
int main(void)
{
   int i;
   for (i=1; i <= 1000; ++i)
   {
     printf("Sending I=%d\n", i);
     syslog(LOG_INFO, "I=%d", i);
   }
   return 0;
}

1. start syslogd (the syslog daemon)
2. send syslogd the STOP signal
3. run the test program (it will block)
4. kill the test program
5. send syslogd the CONT signal

syslogd binds "/dev/log" which "creates" the socket:
$ ls -l /dev/log
srw-rw-rw- 1 root root 0 2007-10-08 09:36 /dev/log=

> Anyway, the default for syslog is to be LOG_ODELAY, so it waits until the
> connection is made before going on. That can be changed using LOG_NDELAY in
> openlog().

LOG_NDELAY and LOG_ODELAY are a different matter.

Regards.

      reply	other threads:[~2007-11-14  9:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-13 14:38 syslog(3) blocks when local socket is full John Sigler
2007-11-13 15:46 ` Luis Claudio R. Goncalves
2007-11-13 16:15   ` John Sigler
2007-11-13 17:14     ` Luis Claudio R. Goncalves
2007-11-14  9:04       ` John Sigler [this message]

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=473ABA2D.6060009@free.fr \
    --to=linux.kernel@free.fr \
    --cc=lclaudio@uudg.org \
    --cc=linux-rt-users@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.