[pgpool-committers: 8529] pgpool: Fix pgpool child process to obtain process information.
Tatsuo Ishii
ishii at sraoss.co.jp
Sat Apr 9 09:34:18 JST 2022
Fix pgpool child process to obtain process information.
ProcesInfo was obtained by using pool_get_process_info(). But this API
is not suitable for child process because:
- does inefficient linear search over all ProcessInfo slots (there are
num_init_children slots).
- due to race condition the search key pid might not be set or removed
in the slot. I think it is possible that by the time when child
process starts execution, the pid is not yet set in the slot in the
shared memory. Also when child process is killed by parent process,
it may set pid to 0 before the child process receive kill signal.
So add new API pool_get_process_info_by_process_id() which just
returns the slot by using global variable my_proc_id as a key and let
child process use it. my_proc_id was set by the parent process when
the child process was spawn.
The call to pool_get_process_info() in child.c was added in v4.3. So
back patch to V4_3_STABLE.
Branch
------
master
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=06f69d19030deb1d72230ce489c5a4d800ad593c
Modified Files
--------------
src/include/pool.h | 1 +
src/main/pgpool_main.c | 9 +++++++++
src/protocol/child.c | 7 +++++--
3 files changed, 15 insertions(+), 2 deletions(-)
More information about the pgpool-committers
mailing list