View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000516||Pgpool-II||Bug||public||2019-05-22 05:51||2020-05-21 11:28|
|Platform||Linux||OS||Ubuntu||OS Version||Xenial 16.04 LTS|
|Target Version||4.0.9||Fixed in Version||4.0.9|
|Summary||0000516: ping probes fail with long hostnames due to small buffer|
|Description||pgpool calls "ping -q -c3 <hostname>" and parses the result to ascertain if a host is up or down. Unfortunately it uses a rather small buffer to read the output and the last line of the ping command can get truncated. This means that pgpool assumes the host is down.|
The offending function is in src/watchdog/wd_ping.c
On line 177 a buffer called "result" of size WD_MAX_PING_RESULT is allocated on the stack. This is only 256 bytes in size. The output of the ping process is read through the outfd in to this.
On line 190 get_result(result) is called on the possibly truncated output. If it fails to parse, it will fail with the error "average RTT value is not greater than zero" and the probe will fail.
|Steps To Reproduce||Set your hostname to something long, (on my offending machines, it's 52 characters long). Use hostnames in the pgpool.conf as the postgres backeneds.|
It doesn't matter if you use the short version of the hostname. If your search path is set in /etc/resolv.conf, it will be expanded to the FQDN
Setting debug level high will show the ping data that is being parsed. You'll notice the truncations on the last line.
|Additional Information||You can work around this by wrapping ping and setting the ping_path in pgpool.conf to point to it. Here's the wrapper I use. It simply discards all but the last line as the parser simply searches for it by skipping the first 4 "/" characters.|
echo "$output" | tail -n 1
Ideally the buffer size could be simply increased or the output file descriptor could be parsed directly until a certain limit of chars was reached negating the need for the buffer altogether.
|Tags||No tags attached.|
|2019-05-22 05:51||Fowler||New Issue|
|2019-05-22 09:41||administrator||Assigned To||=> Muhammad Usama|
|2019-05-22 09:41||administrator||Status||new => assigned|
|2020-02-04 13:22||pengbo||Assigned To||Muhammad Usama => pengbo|
|2020-03-06 16:16||pengbo||Note Added: 0003252|
|2020-03-06 16:16||pengbo||Status||assigned => resolved|
|2020-05-21 11:27||administrator||Fixed in Version||=> 4.0.9|
|2020-05-21 11:27||administrator||Target Version||=> 4.0.9|
|2020-05-21 11:28||administrator||Status||resolved => closed|