Skip to content
Back

SQLSTATE[HY000] [1040] Too many connections

  • 0
  • Databases
obiwanzenobi
10 Oct, 2023, 08:09

After our production release we have a problem handling big traffic logs from appwrite container:

TypeScript
[Error] Timestamp: 2023-10-10T08:04:18+00:00
[Error] Method: GET
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: PDOException
[Error] Message: SQLSTATE[HY000] [1040] Too many connections
[Error] File: /usr/src/code/app/init.php
[Error] Line: 700
[Error] Timestamp: 2023-10-10T08:04:19+00:00
[Error] Method: GET
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents
[Error] Type: PDOException
[Error] Message: SQLSTATE[HY000] [1040] Too many connections
[Error] File: /usr/src/code/app/init.php
[Error] Line: 700
[Error] Timestamp: 2023-10-10T08:04:19+00:00
TL;DR
The support thread discusses an error message: "SQLSTATE[HY000] [1040] Too many connections" that occurs when handling big traffic logs from the Appwrite container. The user considers passing the variables through compose variables or adding them to the .env file. They also mention four variables to try fiddling around with: _APP_CONNECTIONS_MAX, _APP_POOL_CLIENTS, _APP_SERVER_MULTIPROCESS, and _APP_WORKER_PER_CORE, with a corresponding GitHub link. Unfortunately, no solution is provided in the thread.
Drake
11 Oct, 2023, 02:10

You can try fiddling around with:

  • _APP_CONNECTIONS_MAX
  • _APP_POOL_CLIENTS
  • _APP_SERVER_MULTIPROCESS
  • _APP_WORKER_PER_CORE

See https://github.com/appwrite/appwrite/blob/8dce3d586284bced9047b62fbcba3c811776d6e7/app/init.php#L641-L650

obiwanzenobi
11 Nov, 2023, 11:54

these are not present in documentation - should I just put them into .env file?

obiwanzenobi
11 Nov, 2023, 17:25

nvm just pass them through compose variables

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more