all-in-one icon indicating copy to clipboard operation
all-in-one copied to clipboard

postgres FATAL: remaining connection slots are reserved for non-replication superuser connections

Open GUNT0815 opened this issue 1 year ago • 9 comments

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. run nextcloud-aio
  2. produce some traffic on nextcloud e.g. by uploading 1000 small files
  3. sudo docker logs -f nextcloud-aio-database -> will show "FATAL: remaining connection slots are reserved for non-replication superuser connections"
  4. connection to db is lost

Expected behavior

nextcloud-aio can handle all necessary connections to the db

Actual behavior

see above 3 and 4

Host OS

Nextcloud AIO version

latest = Nextcloud Hub II (23.0.6)

Current channel

stable

Other valuable info

grafik

GUNT0815 avatar Jul 21 '22 15:07 GUNT0815

Hi, thanks for your report! Did this happen after upgrading to the latest release or already before?

szaimen avatar Jul 21 '22 15:07 szaimen

I talked to a colleague regarding this and upgrading to NC24 may resolve the issue. Upgrading to NC24 is on the list for the next release so stay tuned!

See https://github.com/nextcloud/all-in-one/issues/669

szaimen avatar Jul 21 '22 16:07 szaimen

I am using a fresh installation from scratch - no update has been run so far.

GUNT0815 avatar Jul 21 '22 17:07 GUNT0815

I did a reboot of the machine and restart of the containers and the error keeps occuring on heavy file transfers. I think this error is received from postgres and we need a different configruation of the db in nextcloud-aio re/ the max_connections allowed ...

GUNT0815 avatar Jul 22 '22 08:07 GUNT0815

Honestly Nextcloud should simply not spawn as many database connections so this is likely a bug. Upgrading to NC24 may resolve this.

szaimen avatar Jul 22 '22 11:07 szaimen

One additional information from today:

  • preview generation is running in the backgroud (manualy triggered) and paperbin for calendar entries is triggered to be emptied
  • message in nextcloud protocol: "Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at "nextcloud-aio-database" (172.26.0.4), port 5432 failed: FATAL: sorry, too many clients already"

IMHO I think in the standard configuration is to narrow for nextcloud.aio and you should think about a changed configuration of postgresql.

GUNT0815 avatar Jul 23 '22 10:07 GUNT0815

I see so the preview generation may be the missing puzzle piece here...

However we will still try to upgrade to nc24 first and if the issue still exists afterwards. If yes we will try to increase the max connections value.

szaimen avatar Jul 24 '22 21:07 szaimen

Hi, please upgrade to 1.7.0 Beta and report back if it fixes the issue. See https://github.com/nextcloud/all-in-one#how-to-switch-the-channel If not, we will need to adjust the database config going forward. Thanks!

szaimen avatar Jul 26 '22 19:07 szaimen

Updating seems to have fixed it for me.

MerlinB avatar Jul 31 '22 05:07 MerlinB