Retool Restarts Due to Postgres max_connections Limit When Running Python Script

Hi,
We’re running into an issue where Retool intermittently restarts, and it seems related to hitting the Postgres max_connections limit. The problem usually appears when executing Python scripts as part of Workflows.

Here’s part of the error log:

{
  "jobId": "4d233172-1c4f-4958-abdc-2667341bc362",
  "level": "error",
  "message": "Error executing block:",
  "organization": { "id": 1, "name": "benayahua@nexite.io" },
  "sequelizeConnectionCount": 1,
  "sequelizeCount": 11,
  "status": "run_block_error",
  "user": { "email": "------, "sid": "user_b033ebe52bfa47bc8954d93be62cbeae" }
}

Is there a recommended way to manage or limit Postgres connections inside Python scripts in Retool? Any tips on avoiding these restarts?

Thanks in advance!

Hi @NexiteAlon,

Welcome to the community! What version of Retool are you running? What do you have the max connections set to? Also, what do you have the POSTGRES_POOL_SIZE_MAX set to?