When pcp child process is forked off, pgpool main process unblock all
signals. This could lead to a race condition if a signal is sent to
the pcp process before it sets up signal handlers. Fix is, do not
unblock signals until the signal handlers are set up.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2023-September/004398.html
close(pipe_fds[1]);
/* call PCP child main */
- POOL_SETMASK(&UnBlockSig);
health_check_timer_expired = 0;
reload_config_request = 0;
pcp_main(fds);
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2022 PgPool Global Development Group
+ * Copyright (c) 2003-2023 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
/* We can now handle ereport(ERROR) */
PG_exception_stack = &local_sigjmp_buf;
+ /*
+ * Unblock signals
+ */
+ POOL_SETMASK(&UnBlockSig);
+
ereport(DEBUG1,
(errmsg("I am PCP child with pid:%d", getpid())));