Re: syslog() thread unsafety

2017-06-14 Thread Eugene Grosbein
15.06.2017 0:09, Konstantin Belousov wrote: > On Wed, Jun 14, 2017 at 11:39:39PM +0700, Eugene Grosbein wrote: >> 14.06.2017 21:12, Konstantin Belousov wrote: >> >>> If the issue is that mpd5 cancels logging thread, and this leaves the >>> mutex in the locked state, the right solution is to establ

Re: syslog() thread unsafety

2017-06-14 Thread Konstantin Belousov
On Wed, Jun 14, 2017 at 11:39:39PM +0700, Eugene Grosbein wrote: > 14.06.2017 21:12, Konstantin Belousov wrote: > > > If the issue is that mpd5 cancels logging thread, and this leaves the > > mutex in the locked state, the right solution is to establish a cleanup > > handler around the locked regi

Re: syslog() thread unsafety

2017-06-14 Thread Eugene Grosbein
14.06.2017 21:12, Konstantin Belousov wrote: > If the issue is that mpd5 cancels logging thread, and this leaves the > mutex in the locked state, the right solution is to establish a cleanup > handler around the locked region. Note that this can only work if the > cancellation is in deferred mode

Re: syslog() thread unsafety

2017-06-14 Thread Konstantin Belousov
On Wed, Jun 14, 2017 at 08:49:36PM +0700, Eugene Grosbein wrote: > Hi! > > Our [v]syslog() implementation in src/lib/libc/gen/syslog.c > tries to be thread-safe and uses "syslog_mutex". > > It may lock this mutex then call blocking system calls like sendto(). > If a thread owning this mutex is pt