brocaar/chirpstack-network-server

Connection reset by peer (upgrade lib/pq)

andyesys opened this issue · 2 comments

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

What happened?

There is an issue with the database access. After running for over a week, we start getting database "connection reset by peer" errors.

I found the issue originates in the lib/pq postgresql driver where broken idle connections are not detected. This is supposed to be fixed starting with version 1.9. Reference: original issue lib/pq#835

This bug also applies to the application server and must be fixed there too.

So in order to fix this please upgrade lib/pq to the newest version here:

github.com/lib/pq v1.8.0

What did you expect?

No connection errors. lib/pq should detect dead idle connections.

Steps to reproduce this issue

Hard to reproduce. Try to place a firewall in between chirpstack and database and reset connections there.

Could you share your log output?

We only have a screenshot:

image

Your Environment

Component Version
Application Server v3.16.0
Network Server v3.14.0
Gateway Bridge v3.12.0
Chirpstack API
Geolocation
Concentratord

Thanks @andyesys, the above commit updates lib/pq to the latest version.

The above commit updates it in the ChirpStack Application Server.