[pgpool-hackers: 49] Re: [pgpool-II 0000009]: dont call syslog(3) family in signal handler.
Tatsuo Ishii
ishii at postgresql.org
Thu Mar 29 13:37:54 JST 2012
Hi,
A fundamental problem with syslog support has been reported to the bug
track. Syslog support was introduced in 3.1:
> - Add syslog support. Patch contributed by Gilles Darold. Review and
> editing by Guillaume Lelarge.
Problem is, syslog support implementation is just replacing vsprintf
etc. like this:
/* Write error message to syslog */
if (pool_config->logsyslog == 1) {
va_start(ap, fmt);
vsyslog(pool_config->syslog_facility | LOG_ERR, fmt, ap);
va_end(ap);
return;
}
So if pool_log() or pool_debug() etc. is called within a signal
handler, it causes a serious problem as reported in the bug track.
(please note that calling pool_log or pool_debug with syslog support
disabled is safe).
Any idea better than dropping the syslog support to fix this?
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp
From: pgpool Bug Tracker <bugtracker at pgpool.net>
Subject: [pgpool-II 0000009]: dont call syslog(3) family in signal handler.
Date: Tue, 27 Mar 2012 18:23:39 +0900
Message-ID: <096846c6f220607be9fa757c536ca1b8 at www.pgpool.net>
>
> The following issue has been SUBMITTED.
> ======================================================================
> http://www.pgpool.net/mantisbt/view.php?id=9
> ======================================================================
> Reported By: harukat
> Assigned To:
> ======================================================================
> Project: pgpool-II
> Issue ID: 9
> Category: Bug
> Reproducibility: sometimes
> Severity: block
> Priority: high
> Status: new
> ======================================================================
> Date Submitted: 2012-03-27 18:23 JST
> Last Modified: 2012-03-27 18:23 JST
> ======================================================================
> Summary: dont call syslog(3) family in signal handler.
> Description:
> Dont call syslog(3) family in signal handler.
> it causes process deadlock.
>
> /* signal handler for SIGALRM */
> static RETSIGTYPE authentication_timeout(int sig)
> {
> pool_log("authentication is timeout");
> child_exit(1);
> }
>
> # gstack 12345
> http://www.pgpool.net/mantisbt/view.php?id=0 0x000000303b2f508e in
> __lll_lock_wait_private () from /lib64/libc.so.6
> http://www.pgpool.net/mantisbt/view.php?id=1 0x000000303b2e22a8 in _L_lock_798
> () from /lib64/libc.so.6
> http://www.pgpool.net/mantisbt/view.php?id=2 0x000000303b2e1d72 in
> __vsyslog_chk () from /lib64/libc.so.6
> http://www.pgpool.net/mantisbt/view.php?id=3 0x000000000041232c in pool_log ()
> http://www.pgpool.net/mantisbt/view.php?id=4 0x0000000000408b20 in
> authentication_timeout ()
> http://www.pgpool.net/mantisbt/view.php?id=5 <signal handler called>
> http://www.pgpool.net/mantisbt/view.php?id=6 0x000000303b2e6812 in send () from
> /lib64/libc.so.6
> http://www.pgpool.net/mantisbt/view.php?id=7 0x000000303b2e1e80 in
> __vsyslog_chk () from /lib64/libc.so.6
> http://www.pgpool.net/mantisbt/view.php?id=8 0x000000000041232c in pool_log ()
> http://www.pgpool.net/mantisbt/view.php?id=9 0x0000000000409872 in do_accept ()
> http://www.pgpool.net/mantisbt/view.php?id=10 0x0000000000409b5b in do_child ()
> http://www.pgpool.net/mantisbt/view.php?id=11 0x0000000000404085 in fork_a_child
> ()
> http://www.pgpool.net/mantisbt/view.php?id=12 0x00000000004059bc in reaper ()
> http://www.pgpool.net/mantisbt/view.php?id=13 0x00000000004073c3 in main ()
>
> Additional Information:
> pgpool-II 3.1.3
> ======================================================================
>
> Issue History
> Date Modified Username Field Change
> ======================================================================
> 2012-03-27 18:23 harukat New Issue
> ======================================================================
>
More information about the pgpool-hackers
mailing list