[pgpool-committers: 7808] pgpool: Fix orphan process is left when pgpool is going down.
Tatsuo Ishii
ishii at sraoss.co.jp
Wed Jun 9 19:36:34 JST 2021
Fix orphan process is left when pgpool is going down.
When pgpool is going down while follow primary command is ongoing,
some process started by follow primary child process could be left.
The follow primary child calls trigger_failover_command() to run the
follow primary script by using system(3). Unfortunately the process
started by system(3) was not tracked by anyone and it was possible
that the process(es) are left. To reproduce the problem you can edit
the test script (test,sh) for the regression test
075.detach_primary_left_down to change the timeout counter to small
number, say 1. i.e.,
change:
cnt=60
to
cnt=1
To fix the problem, the follow primary child process calls setsid(2)
to set new session id. When Pgpool-II main goes down, the exit handler
kills all the process including the process started by system(3), by
specifying kill(-(follow primary child process pid)).
Also in the initialization of the follow primary process, unmask
signals and assign default behavior to each signal (this should have
been done much earlier).
Branch
------
master
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=810eb97717dc7b265f8ae53478f3a7bb3517318d
Modified Files
--------------
src/main/pgpool_main.c | 69 +++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 63 insertions(+), 6 deletions(-)
More information about the pgpool-committers
mailing list