Using sqlx
with a couple concurrent connections I ran quickly into the issue of Too many open connections
. Limiting db.DB.MaxOpenConnections
got actually rid of the problem and activated the connection pooling I was hoping for.
Now on some machines we observe at a test, which tests exactly that the too many open connections doesn't happen a different error:
read tcp [::1]:54883->[::1]:5432: read: connection reset by peer
read tcp [::1]:54886->[::1]:5432: read: connection reset by peer
read tcp [::1]:54884->[::1]:5432: read: connection reset by peer
read tcp [::1]:54887->[::1]:5432: read: connection reset by peer
read tcp [::1]:54885->[::1]:5432: read: connection reset by peer
read tcp [::1]:54888->[::1]:5432: read: connection reset by peer
…
The Postgres logs don't reveal anything. Could it be possible that this happens on the network stack? What else can I do to debug this? I cannot reproduce it locally.