pgwatch uses inactive session #910
Replies: 10 comments
-
Thanks. This is how pgxpool works. If there was a loss of connection, then we need to reconnect. We will do it when the new measurements are fetched. So this is a expected workflow. Every connection has a max connection idle timeout set to 15sec. So every idle connection will be either reestablished, or closed. I'm not sure why we see exactly this message though. Do you use pgbouncer? |
Beta Was this translation helpful? Give feedback.
-
No we are not using pgbouncer, also the problem was there for hours before I did a manual restart |
Beta Was this translation helpful? Give feedback.
-
I looks like it cannot handle end of connection on database restart. I've restarted bunch of databases, and the connections did not recover until pgwatch restart |
Beta Was this translation helpful? Give feedback.
-
thanks, that's reaaly weird. I will try to reproduce |
Beta Was this translation helpful? Give feedback.
-
I did some digging. |
Beta Was this translation helpful? Give feedback.
-
I found start of today. |
Beta Was this translation helpful? Give feedback.
-
Hi, I had no chance to reproduce this issue locally. But I'm keeping my eye on it. So if you have anything to add, please, be my guest. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your time, unfortunately I do not have much of a new information, except for that is happening repeatedly on some instances. From what I gathered it happens when pgwatch monitores db for some time, then there is some longer loss of connection like db restart. After that pgwatch can use the instance_up - i.e. Connection check, but any other metric fails. |
Beta Was this translation helpful? Give feedback.
-
I've redacted actual names and conn strings but this is logs from two of the failed instances from this evening 2025-07-07 22:17:37.234 This log corrects my previous statement instance_up seems without debug OK, but also fails. On the other hand 2025-07-07 22:09:47.254 2025-07-07 22:09:52.563 2025-07-07 22:10:00.006 2025-07-07 22:10:03.597 Connect seems OK, prints correct version and so on, but any other metric fails until pgwatch is restarted |
Beta Was this translation helpful? Give feedback.
-
Hi,
In this case There is Connect OK from reaper.go FetchRuntimeInfo but password error from actual metrics |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
In some scenarios, there is a loss of connection between database and pgwatch.
In that time in both pgwatch and database logs there is a log variant on FATAL: password authentication failed for user "pgwatch"
While investigating I've checked DNS, IPs, password etc.
I've fond idle pgwatch connection in db and removed it but the problem still remained.
pgwatch restart fixed the issue at least for a while
To Reproduce
I am unable to tell how exactly the error occurs
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
pgwatch seems to try to use and old connection from it's memmory, that does not exists in the database no more.
Creating new connection fixes the issue
Beta Was this translation helpful? Give feedback.
All reactions