maps icon indicating copy to clipboard operation
maps copied to clipboard

[Bug]: sorry, too many clients already | 5000+ photos

Open adripo opened this issue 3 years ago • 9 comments

⚠️ This issue respects the following points: ⚠️

Bug description

I am experiencing postgresql errors related to the number of connected clients and my Nextcloud instance become unresponsive (db connection missing for other tasks).

image

I think the error is related to the requests that are made to retrieve photos data from the db. I have 5000+ photos that have to be shown on the map so the connection towards the db is saturated.

Steps to reproduce

  1. Go to /apps/maps/
  2. Wait to load
  3. Error

Expected behavior

Load images without DB error.

Installation method

Official Docker image

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install of the server?

None

Is this bug present after an update or on a fresh install of the app?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • [X] Default user-backend (database)
  • [ ] LDAP/ Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Configuration report

v24.0.7

List of activated Apps

Different apps, the problem appears only when I try to load the map page

Nextcloud Signing status

No response

Nextcloud Logs

Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[08006] [7] FATAL: sorry, too many clients already

Browser Console

No response

Additional info

No response

adripo avatar Dec 05 '22 01:12 adripo

I think the problem could be in this foreach: https://github.com/nextcloud/maps/blob/master/lib/Service/GeophotoService.php#L78

Can this logic be changed to group multiple queries in less requests on the db?

adripo avatar Dec 05 '22 02:12 adripo

Yes probably.

Can this logic be changed to group multiple queries in less requests on the db? Yes probably

But I think the proper way to fix this is to find the files via a dav search request for metadata.

tacruc avatar Mar 03 '23 08:03 tacruc

Is dav used for other operations in this app? I can test if you need validation on this bug

adripo avatar Mar 03 '23 12:03 adripo

Not really. But everywhere else in nextcloud.

tacruc avatar Mar 03 '23 13:03 tacruc

same issue here with Nextcloud 27.0.0. I have only a small amount of images in Nextcloud (< 50). The error occurs if I open the Photos overview. I have to restart the docker containers to continue working with Nextcloud.

abentele avatar Jul 14 '23 18:07 abentele

I'm running into the same issue with version 27.0.1 deployed via official docker using PSQL. This only started after I updated to the latest version. Is there any fix for this yet?

peterpicard avatar Jul 31 '23 09:07 peterpicard

For me, deactivation of some plug-ins fixed it. Unfortunately I don't remember which plug-in it was.

abentele avatar Jul 31 '23 10:07 abentele