From c87d307e8c41207b62f0c1b4c4aa93967f981c09 Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Sun, 9 Mar 2025 20:36:36 +0200 Subject: [PATCH] Print state of connection buffer when no response is receioved from PS for a long time (#11145) ## Problem See https://neondb.slack.com/archives/C08DE6Q9C3B Sometimes compute is not able to receive responses from PS for a long time (minutes). I do not think that the problem is at compute side, but in order to exclude this possibility I wan to see more information about connection state at compute side, particularly amount of data cached in connection buffer. ## Summary of changes Right now we are dumping state of socket buffer. This PR adds printing state of connection buffer. --------- Co-authored-by: Konstantin Knizhnik --- pgxn/neon/libpagestore.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pgxn/neon/libpagestore.c b/pgxn/neon/libpagestore.c index 49f12bbb9e..637281fe4a 100644 --- a/pgxn/neon/libpagestore.c +++ b/pgxn/neon/libpagestore.c @@ -16,6 +16,8 @@ #include +#include "libpq-int.h" + #include "access/xlog.h" #include "common/hashfn.h" #include "fmgr.h" @@ -815,9 +817,10 @@ retry: get_socket_stats(PQsocket(pageserver_conn), &sndbuf, &recvbuf); neon_shard_log(shard_no, LOG, - "no response received from pageserver for %0.3f s, still waiting (sent " UINT64_FORMAT " requests, received " UINT64_FORMAT " responses) (socket sndbuf=%d recvbuf=%d)", + "no response received from pageserver for %0.3f s, still waiting (sent " UINT64_FORMAT " requests, received " UINT64_FORMAT " responses) (socket sndbuf=%d recvbuf=%d) (conn start=%d end=%d)", INSTR_TIME_GET_DOUBLE(since_start), - shard->nrequests_sent, shard->nresponses_received, sndbuf, recvbuf); + shard->nrequests_sent, shard->nresponses_received, sndbuf, recvbuf, + pageserver_conn->inStart, pageserver_conn->inEnd); shard->receive_last_log_time = now; shard->receive_logged = true; }