Обсуждение: BUG #11095: quickdie() calls syslog() in a signal handler leading to deadlock
BUG #11095: quickdie() calls syslog() in a signal handler leading to deadlock
От
craig@tintri.com
Дата:
The following bug has been logged on the website: Bug reference: 11095 Logged by: Craig Robson Email address: craig@tintri.com PostgreSQL version: Unsupported/Unknown Operating system: Linux Description: We are using log_destination='syslog'. We found one of our Postgresql processes deadlocked with this backtrace. It is not safe to call syslog() in a signal handler on Linux. We are using version 8.4.20. I looked at newer versions sourcecode and I believe they have the same problem. > #0 0x00007fe357ee3a7e in __lll_lock_wait_private () from /lib64/libc.so.6 > #1 0x00007fe357e71e29 in _L_lock_10462 () from /lib64/libc.so.6 > #2 0x00007fe357e6fa52 in malloc () from /lib64/libc.so.6 > #3 0x00007fe357e64648 in open_memstream () from /lib64/libc.so.6 > #4 0x00007fe357ed10bb in __vsyslog_chk () from /lib64/libc.so.6 > #5 0x00007fe357ed1693 in __syslog_chk () from /lib64/libc.so.6 > #6 0x000000000069a2a3 in syslog (__fmt=0x7e08ce "[%lu-%d] %s", __pri=5) at /usr/include/bits/syslog.h:32 > #7 write_syslog (level=5, line=0xbe2ac0 "WARNING: terminating connection because of crash of another server process\nDETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another ser"...) at elog.c:1592 > #8 0x000000000069c6d7 in send_message_to_server_log (edata=0xac9bc0) at elog.c:2238 > #9 EmitErrorReport () at elog.c:1204 > #10 0x000000000069cd80 in errfinish (dummy=<optimized out>) at elog.c:457 > #11 0x00000000005ea19d in quickdie (postgres_signal_arg=<optimized out>) at postgres.c:2502 > #12 <signal handler called> > #13 0x00007fe357e6eae6 in _int_malloc () from /lib64/libc.so.6 > #14 0x00007fe357e6fa5d in malloc () from /lib64/libc.so.6 ... Rest of stack trace removed.
craig@tintri.com writes: > We found one of our Postgresql processes deadlocked with this backtrace. It > is not safe to call syslog() in a signal handler on Linux. We are using > version 8.4.20. I looked at newer versions sourcecode and I believe they > have the same problem. Well, the alternatives are to do this or not leave any trace of why the process exited. Newer versions than 8.4 (which is EOL btw) have an amelioration mechanism for this and related risks, which is that the postmaster SIGKILLs any child that doesn't exit within a few seconds. regards, tom lane