pgpool2.git / summary / log / commit / refs
commit 565bb3e23deed36b2a186de2ceab1a44db559bb9
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Sat Mar 31 09:34:21 2012 +0000
Fix deadlock by enabling log_destination = syslog reported in bug
tracker http://www.pgpool.net/mantisbt/view.php?id=9. The workaround
is blocking signal before calling vsyslog in pool_log etc. This has
been already done log_destination = stderr case. Patch provided by
Gilles Darold.
Committed to master and V3_1_STABLE.
pool_error.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/pool_error.c b/pool_error.c
index 982870beb..f23867218 100644
--- a/pool_error.c
+++ b/pool_error.c
@@ -50,16 +50,17 @@ void pool_error(const char *fmt,...)
#else
int oldmask;
#endif
+ POOL_SETMASK2(&BlockSig, &oldmask);
+
/* 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);
+ POOL_SETMASK(&oldmask);
return;
}
- POOL_SETMASK2(&BlockSig, &oldmask);
-
if (pool_config->print_timestamp)
#ifdef HAVE_ASPRINTF
len = asprintf(&fmt2, "%s ERROR: pid %d: %s\n", nowsec(), (int)getpid(), fmt);
@@ -112,16 +113,18 @@ void pool_debug(const char *fmt,...)
if (pool_config->debug_level <= 0)
return;
}
+
+ POOL_SETMASK2(&BlockSig, &oldmask);
+
/* Write debug message to syslog */
if (pool_config->logsyslog == 1) {
va_start(ap, fmt);
vsyslog(pool_config->syslog_facility | LOG_DEBUG, fmt, ap);
va_end(ap);
+ POOL_SETMASK(&oldmask);
return;
}
- POOL_SETMASK2(&BlockSig, &oldmask);
-
if (pool_config->print_timestamp)
#ifdef HAVE_ASPRINTF
len = asprintf(&fmt2, "%s DEBUG: pid %d: %s\n", nowsec(), (int)getpid(), fmt);
@@ -163,16 +166,18 @@ void pool_log(const char *fmt,...)
#else
int oldmask;
#endif
+
+ POOL_SETMASK2(&BlockSig, &oldmask);
+
/* Write log message to syslog */
if (pool_config->logsyslog == 1) {
va_start(ap, fmt);
vsyslog(pool_config->syslog_facility | LOG_NOTICE, fmt, ap);
va_end(ap);
+ POOL_SETMASK(&oldmask);
return;
}
- POOL_SETMASK2(&BlockSig, &oldmask);
-
if (pool_config->print_timestamp)
#ifdef HAVE_ASPRINTF
len = asprintf(&fmt2, "%s LOG: pid %d: %s\n", nowsec(), (int)getpid(), fmt);
[parent: 1ea486c29e8f]