[Pgpool-general] Issues with health checking in 2.5

Jacques Caron jc at directinfos.com
Wed Feb 9 10:09:30 GMT 2005


Hi,

At 07:58 09/02/2005, Tatsuo Ishii wrote:
>The health checking is done in the pgpool parent process and there's
>no any other alarams in the process(child life alarm is done in
>children). So my guess is that connect() is interrupted by SIGCHLD,
>not SIGALARM. So the fix would be either 1) block SIGCHLD while
>connect() is trying, or 2) make sure that connect() is interrupted by
>SIGALARM. What do you think?

Reading the manpages of sigaction and connect, it seems that SA_RESTART 
(which is set for SIGCHLD) is not handled by connect(), and connect() will 
return with EINTR, but still continue to connect in the background (as if 
it had returned EINPROGRESS), at least with FreeBSD (don't know if this is 
standard on other platforms, though).

The "right" way to do it would then be to add some additional logic when 
connect returns EINTR to determine whether it is a timeout (SIGALARM) or 
some other signal. In the case of another signal, it should perform a 
select() to wait for the connect to happen, and then somehow check whether 
the connect was successful or not (including timeouts). Alternatively, the 
connect() might be done non-blocking which would mean it would always be 
done that way.

However, this seems awfully complex to me to handle such a simple case. 
Wouldn't it be simpler to move the health checking to a child (either one 
existing child or a dedicated one)? This would also eliminate any blocking 
of the main process during connect().

Jacques.




More information about the Pgpool-general mailing list