[pgpool-general: 7999] Re: pcp_node_info does not return when host is lost on 4.3.0

Emond Papegaaij emond.papegaaij at gmail.com
Wed Jan 26 01:57:43 JST 2022


On Tue, Jan 25, 2022 at 4:49 PM Emond Papegaaij <emond.papegaaij at gmail.com>
wrote:

> On Tue, Jan 25, 2022 at 3:57 PM Emond Papegaaij <emond.papegaaij at gmail.com>
> wrote:
>
>> On Tue, Jan 25, 2022 at 2:19 PM Tatsuo Ishii <ishii at sraoss.co.jp> wrote:
>>
>>> > After more thought, I think get_nodes ("gut" of pcp_node_info) should
>>> > not try to connect to PostgreSQL at all if it already knows the
>>> > PostgreSQL server is down (actually get_nodes() calls PQpingParams()
>>> > and it already knows whether PostgreSQL server is up or not). In this
>>> > case it can immediately return "unknown" for pg_role field, and thus
>>> > it can avoid the hang.
>>> >
>>> > Attached is the patch. In the mean time please disregard the previous
>>> patch.
>>>
>>> Oops. I attached wrong patch. I attach the new patch.
>>>
>>
>> I've pinpointed the issue to the exact location changed by your patch.
>> With plain 4.3.0, the worker stops at this line:
>>  snprintf(nodes[i].pg_status, POOLCONFIG_MAXSTATLEN, "%s",
>> db_node_status(i));
>>
>> I've inserted a log statement right before and after that line. The one
>> before shows up, the one after does not. I'll give your patch a try now.
>>
>
> As I expected to happen, with your patch, the pcp worker still hangs, but
> no longer tries to connect to the database. Your patch moves the call to
> db_node_status to before the database connection, so now it seems to hang
> before connecting. I'll continue my effort in pinpointing the exact
> location of the failure by adding tracing to the db_node_status function.
>

It seems it's the call to PQpingParams in db_node_status that's causing the
problems:
ret = PQpingParams(keywords, values, 1);

The worker never gets past that point for node 2. I hope this helps you
address the issue.

Best regards,
Emond
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20220125/56cfa909/attachment.htm>


More information about the pgpool-general mailing list