Fix oversight in connection_life_time fix.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Sat, 15 Aug 2020 03:37:39 +0000 (12:37 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Sat, 15 Aug 2020 03:37:39 +0000 (12:37 +0900)
Commit 39eb90fe199d03253b99bec38d85c40f66aa55ab did not consider the case
when node is down connection struct is NULL. As a result, segfault occurred.

src/protocol/pool_connection_pool.c

index 0c77cbfca3aff2efbf0ff99d2af6a10e0024d756..05954335602f8daf633e07904aa27f9c396687cb 100644 (file)
@@ -350,7 +350,8 @@ pool_connection_pool_timer(POOL_CONNECTION_POOL * backend)
        /* Set connection close time */
        for (i = 0; i < NUM_BACKENDS; i++)
        {
-               CONNECTION_SLOT(backend, i)->closetime = time(NULL);
+               if (CONNECTION_SLOT(backend, i))
+                       CONNECTION_SLOT(backend, i)->closetime = time(NULL);
        }
 
        if (pool_config->connection_life_time == 0)