Fix health checking process death and forking forever.
authorTatsuo Ishii <ishii@postgresql.org>
Mon, 18 Dec 2017 22:25:35 +0000 (07:25 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Mon, 18 Dec 2017 22:25:35 +0000 (07:25 +0900)
When failed to read from backend socket (this could happen when wrong
health_check_user is specified), the health check process raises a
FATAL error in pool_read(), which causes death of health check
process. And Pgpool-II main forks off a new health check process. This
repeats forever.

Fix is, check the process type and it raises if the type is HEALTH
CHECK in addition to MAIN.

Back patch to 3.7 stable tree as well.

src/utils/pool_stream.c

index 1c99152829726b0f9aa3d0bd2129aae6b4808552..4fc78bd13d4b611f7cc5f7d6223e282e747d3d2a 100644 (file)
@@ -246,7 +246,7 @@ int pool_read(POOL_CONNECTION *cp, void *buf, int len)
                        cp->socket_state = POOL_SOCKET_EOF;
                        if (cp->isbackend)
                        {
-                               if(processType == PT_MAIN)
+                               if (processType == PT_MAIN || processType == PT_HEALTH_CHECK)
                                        ereport(ERROR,
                                                (errmsg("unable to read data from DB node %d",cp->db_node_id),
                                                         errdetail("EOF encountered with backend")));