[pgpool-committers: 3410] Re: pgpool: Fix a posible hang during health checking
Muhammad Usama
m.usama at gmail.com
Thu Aug 18 19:56:30 JST 2016
Hi Yugo.
I was looking at the code and this commit. You are only checking the
pocessState in pool_check_fd() to declare if the timeout has
occurred during a health check. Shouldn't we also check if the signal was
actually the health check timer expire to make sure that we do not declare
the timer expire because of some other signal arrived while waiting for
data.
Can you please have a look at the attached patch to do the same, Do you
think it is the right approach?
Thanks
Kind regards
Muhammad Usama
On Wed, Jun 8, 2016 at 5:15 PM, Yugo Nagata <nagata at sraoss.co.jp> wrote:
> Fix a posible hang during health checking
>
> Helath checking was hang when any data wasn't sent
> from backend after connect(2) succeeded. To fix this,
> pool_check_fd() returns 1 when select(2) exits with
> EINTR due to SIGALRM while health checkking is performed.
>
> Reported and patch provided by harukat and some modification
> by Yugo. Per bug #204.
>
> Branch
> ------
> V3_4_STABLE
>
> Details
> -------
> http://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=
> ed9f2900f1b611f5cfd52e8f758c3616861e60c0
>
> Modified Files
> --------------
> src/protocol/pool_process_query.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> _______________________________________________
> pgpool-committers mailing list
> pgpool-committers at pgpool.net
> http://www.pgpool.net/mailman/listinfo/pgpool-committers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.sraoss.jp/pipermail/pgpool-committers/attachments/20160818/0d16b546/attachment.html>
-------------- next part --------------
diff --git a/src/protocol/pool_process_query.c b/src/protocol/pool_process_query.c
index fe0df4d..cc666b7 100644
--- a/src/protocol/pool_process_query.c
+++ b/src/protocol/pool_process_query.c
@@ -639,9 +639,10 @@ int pool_check_fd(POOL_CONNECTION *cp)
save_errno = errno;
if (fds == -1)
{
- if (processState == PERFORMING_HEALTH_CHECK && errno == EINTR)
+ if (processType == PT_MAIN && processState == PERFORMING_HEALTH_CHECK && errno == EINTR && health_check_timer_expired)
{
- ereport(WARNING, (errmsg("health check timed out while waiting for reading data")));
+ ereport(WARNING,
+ (errmsg("health check timed out while waiting for reading data")));
errno = save_errno;
return 1;
}
More information about the pgpool-committers
mailing list