[pgpool-hackers: 55] Re: [pgpool-II 0000009]: dont call syslog(3) family in signal handler.

Gilles Darold gilles.darold at dalibo.com
Sat Mar 31 17:26:30 JST 2012


Hi,

Le 31/03/2012 04:40, Tatsuo Ishii a écrit :
>> Well that was a very quick and dirty look, I was thinking that perhaps
>> we can use send_frontend_exits() from child_exit() to send the
>> information to the parent process. But after taking the time to read
>> source code it is related to the backend connection, so sorry for the noise.
>>
>> So we still have to find a solution to print the "authentication timeout
>> message" outside the signal handler mostly from the parent process. Do
>> you have an idea on how to proceed ?
> Quick loook by using "grep RETSIGTYPE" reveleas that there are number
> of placess where pool_log etc. get called in a signal handler. This is
> not the whole story of course. Even there's no pool_log calls, it is
> possible that a function called in a signal handler calls pool_log.
>
> I think the only solution is, pool_log does not call syslog if called
> in a signal handler. However I could find a way for a function to know
> if it is called within a signal handler. What about setting a global
> flag at the beginning of a signal handler. When pool_log is called and
> if it finds the flag being set, it does not call syslog.

A common workaround on syslog or other non signal safe function issue is
to block signals before calling vsyslog functions and unblock them
after. Looking at the pool_error.c file this was already done but syslog
functions call are done before the signal blocking, my bad. Here is a
patch that should fix the problem.

-- 
Gilles Darold
http://dalibo.com - http://dalibo.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgpool2-signal-safe-syslog.diff
Type: text/x-patch
Size: 1747 bytes
Desc: not available
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20120331/03f8cf45/attachment.bin>


More information about the pgpool-hackers mailing list