<div dir="ltr"><div dir="ltr">On Tue, Jan 25, 2022 at 3:57 PM Emond Papegaaij <<a href="mailto:emond.papegaaij@gmail.com">emond.papegaaij@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Tue, Jan 25, 2022 at 2:19 PM Tatsuo Ishii <<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> After more thought, I think get_nodes ("gut" of pcp_node_info) should<br>
> not try to connect to PostgreSQL at all if it already knows the<br>
> PostgreSQL server is down (actually get_nodes() calls PQpingParams()<br>
> and it already knows whether PostgreSQL server is up or not). In this<br>
> case it can immediately return "unknown" for pg_role field, and thus<br>
> it can avoid the hang.<br>
> <br>
> Attached is the patch. In the mean time please disregard the previous patch.<br>
<br>
Oops. I attached wrong patch. I attach the new patch.<br></blockquote><div><br></div><div>I've pinpointed the issue to the exact location changed by your patch. With plain 4.3.0, the worker stops at this line:</div><div> snprintf(nodes[i].pg_status, POOLCONFIG_MAXSTATLEN, "%s", db_node_status(i));</div><div><br></div><div>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.</div></div></div></blockquote><div><br></div><div>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.</div><div><br></div><div>Best regards,</div><div>Emond </div></div></div>