Fix yet another reset query stuck problem.
authorTatsuo Ishii <ishii@postgresql.org>
Thu, 24 Jul 2014 06:26:55 +0000 (15:26 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Thu, 24 Jul 2014 06:26:55 +0000 (15:26 +0900)
If client_idle_limit is set and the idle limit reaches,
pool_process_query() returns and tries to execute reset query which
may not be acceptable by backend because it may not be in "ready for
query" state. The fix is, close connections to backend instead.

Per bug#107.
See also: http://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=52a3a8c6ab67be3e09db9a7bdfd8e74d81ae3687

pool_process_query.c

index e6ada258e1a10728b655a74d9a7debbdf16ca7e7..c4417ef07498d032cf4f614e8228175b806dc774 100644 (file)
@@ -4877,12 +4877,12 @@ SELECT_RETRY:
 
                        if (idle_count > pool_config->client_idle_limit)
                        {
-                               pool_log("pool_process_query: child connection forced to terminate due to client_idle_limit(%d) reached",
+                               pool_log("pool_process_query: child connection forced to terminate due to client_idle_limit (%d) reached",
                                                 pool_config->client_idle_limit);
                                pool_send_error_message(frontend, MAJOR(backend),
                                                                                "57000", "connection terminated due to client idle limit reached",
                                                                                "","",  __FILE__, __LINE__);
-                               return POOL_END;
+                               return POOL_END_WITH_FRONTEND_ERROR;
                        }
                }
                else if (*InRecovery > RECOVERY_INIT && pool_config->client_idle_limit_in_recovery > 0)