BUG #11095: quickdie() calls syslog() in a signal handler leading to deadlock

From: craig(at)tintri(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #11095: quickdie() calls syslog() in a signal handler leading to deadlock
Date: 2014-07-30 23:33:28
Message-ID: 20140730233328.2696.87275@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 11095
Logged by: Craig Robson
Email address: craig(at)tintri(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrey Zhidenkov 2014-07-31 05:56:13 Re: [ADMIN] Can postgres run autovacuum tasks when autovacuum is disabled?
Previous Message Bruce Momjian 2014-07-30 22:49:09 Re: BUG #10991: psql -c ignores my pager settings in ~/.psqlrc