[syslog-ng] syslog-ng 3.3.1 quits at reload

Michael Hocke michael.hocke at nyu.edu
Wed Nov 30 21:21:39 CET 2011


-----BEGIN PGP SIGNED MESSAGE-----


On Nov 29, 2011, at 1:10 PM, Michael Hocke wrote:

> Sorry for following up on my own posting. I just checked the OpenSolaris sources and it is definitely something specific to Solaris. The /dev/log device can only be cloned up to LOG_NUMCLONES times which is defined as 16 in <sys/log.h>. Every open call on /dev/log clones the device and since it seems that /dev/log is not closed when a HUP is received the number of clones accumulate until after the 16th HUP signal it tries to execute open64("/dev/log", O_RDONLY|O_NONBLOCK|O_NOCTTY) which results in an ENXIO error.

I put in a quick and dirty fix for the problem I am seeing. I made sure that the /dev/log device is being closed in afstreams_sd_deinit(). I am very sure this is not the right place and it should probably be closer to LogTransport but that would probably require some extra flags and methods since there is no log_transport_deinit() and a closing of the fd for all kinds of transports is probably not desired. Anyway, here is the "fix" I put in place:

# diff afstreams.c afstreams.c.orig 
37d36
<   gint log_fd;
166a166
>   gint fd;
173,174c173,174
<   self->log_fd = open(self->dev_filename->str, O_RDONLY | O_NOCTTY | O_NONBLOCK);
<   if (self->log_fd != -1)
- ---
>   fd = open(self->dev_filename->str, O_RDONLY | O_NOCTTY | O_NONBLOCK);
>   if (fd != -1)
178c178
<       g_fd_set_cloexec(self->log_fd, TRUE);
- ---
>       g_fd_set_cloexec(fd, TRUE);
181c181
<       if (ioctl(self->log_fd, I_STR, &ioc) < 0)
- ---
>       if (ioctl(fd, I_STR, &ioc) < 0)
187c187
<           close(self->log_fd);
- ---
>           close(fd);
190,191c190,191
<       g_fd_set_nonblock(self->log_fd, TRUE);
<       self->reader = log_reader_new(log_proto_dgram_server_new(log_transport_streams_new(self->log_fd), self->reader_options.msg_size, 0));
- ---
>       g_fd_set_nonblock(fd, TRUE);
>       self->reader = log_reader_new(log_proto_dgram_server_new(log_transport_streams_new(fd), self->reader_options.msg_size, 0));
207c207
<                     evt_tag_int("fd", self->log_fd),
- ---
>                     evt_tag_int("fd", fd),
211c211
<           close(self->log_fd);
- ---
>           close(fd);
239,240d238
<   if (self->log_fd != -1)
<     close (self->log_fd);

I pretty much store the fd of the log device in AFStreamsSourceDriver and use that in afstreams_sd_deinit().

- - Michael
-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 10.0.3 (Build 1)
Charset: us-ascii

wsBVAwUBTtaQVJbfnpCg64TVAQE8IAf/cj4FJ5rtlnyb6nnmYQrJikE7h4toAD4m
BARVTOce1LrmyU827jjbkg6bUqlO5dZwD02mGOoN260I6HLW5bcWYLaevvJKAWZH
Y1/LaDTA9XDnOZZkM2YMqWi+yHYftsRB1rTDNcyCvwFr/LiYd2HVVBqHGTEssZed
zBM1xUvqrESk20Gqw1VUh10SFvZd2yNn4uxdrC5Pz8RpYjxPFiaEiMF7VDHDti23
xS4tCbSj2PzzrtQykYjh6HQSkm6o0A0155d9b4MMHWT84rRTxjuNgve7DzfLRvCv
oJ3fc8u+lQLe2Akps37h+apRXYWvSvarPk26hlzKqp1plNZ8R+OmYQ==
=qLWQ
-----END PGP SIGNATURE-----


More information about the syslog-ng mailing list