Fix exit signal handlers to not call ereport.
authorTatsuo Ishii <ishii@postgresql.org>
Fri, 22 Sep 2017 01:51:45 +0000 (10:51 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Fri, 22 Sep 2017 02:01:43 +0000 (11:01 +0900)
commite18632ebed7069243d919293cc4e3aa760c3d91a
treef48c1974a1a252db91a38591ffdb92b89c074e60
parent3cc5235a4c9ba8b4193308b95a7f21ba80d10a83
Fix exit signal handlers to not call ereport.

There could be a race condition in the exit signal handlers. While
ereport is called in the handler, other interruption could call
ereport again. If ereport calls tz_convert which tries to acquire a
lock, it goes into a deadlock situation. In other word, tz_convert is
not reentrant and should not be used in signal handlers. So I removed
all ereport calls from exit signal handlers.

BTW pcp main calls ereport before the exception handler is
established. This could cause problem of course. So I fixed this
together. See [pgpool-hackers: 2545] for more details.
src/main/pgpool_main.c
src/pcp_con/pcp_child.c