On Jul 6 00:29, Takashi Yano wrote: > Hi Corinna, > > On Wed, 4 Jul 2018 16:52:47 +0200 > Corinna Vinschen wrote: > > Hang on. /dev/kmsg was implemented using a mailslot and it was never > > accessible via the syslog(3) interface. The code you removed has > > nothing to do with /dev/kmsg. > > First of all, /dev/kmsg was not guilty. The real culprit is the code > I had removed by the previous patch. > > However, the patch I posted was based on mis-understanding regarding > AF_UNIX implementation. I had checked fhandler_socket_unix.cc and > thought cygwin AF_UNIX socket is implemented not using AF_INET socket. > On the other hand, the code, I removed, checks existence of UDP socket > to determine whether syslogd is activated. So I thought this is no > longer correct and should be removed. > > As a matter of fact, cygwin AF_UNIX socket usually use fhandler_socket_ > local.cc, in which AF_UNIX socket is implemented using AF_INET socket. > That is, the obove understanding was incorrect. > > > What the code does is to check if we have a listener on the /dev/msg UDP > > socket, otherwise log data may get lost or, IIRC, the syslog call may > > even hang. So removing this code sounds like a bad idea. > > In the case of syslogd is not activated, /dev/log does not exist. > So connect() results in an error. Therefore log data is directed to > windows event logging mechanism even without the removed code. In > usual case, no problem happens. However if syslogd is killed by signal > 9 or died accidently, /dev/log remains without listener. In this case, > the problem you mentioned may happen. > > > Can you please explain *why* removing this code helps and what happens > > if syslogd is not running after removing the code? > > OK. First, connect_syslogd() tries to connect to syslogd via /dev/log > which is created by syslogd. However, the code which I removed can not > perform checking existence of syslogd as expected. > Previously, get_inet_addr() is used to get name information of the socket > opened by syslogd. This was working correctly at that time. Currently, > getsockname() is used instead. This does not return name infomation of > the socket on syslogd side but returns that of client side. Since no > listener exists for this socket, it is not listed in the table returned > by GetUdpTable(). Therefore this check results in false. > > As a result, current connect_syslogd() code gives up to connect to syslogd. > > To fix this, I made a new patch attached. In this patch, get_inet_addr_local() > is used instead of getsockname() as in the past. > > I will appreciate any comments.
Thanks a lot for the detailed analysis. Patch pushed. Thanks Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
signature.asc
Description: PGP signature
