"FATAL: sorry, too many clients" error when collecting real time data

We are getting the following error when trying to collect real time data.

quantrocket.countdown: ERROR msg: 'error running function: (''500 Server Error: Internal Server Error for url:
quantrocket.countdown: ERROR http://houston/realtime/databases/vix20210219t154302db?conids=13455763&fields=LastPrice'',
quantrocket.realtime: ERROR File "/opt/conda/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 66, in exit
quantrocket.countdown: ERROR {''status'': ''error'', ''msg'': ''an unhandled exception occurred, please check
quantrocket.realtime: ERROR compat.reraise(exc_type, exc_value, exc_tb)
quantrocket.countdown: ERROR flightlog for the traceback and notify support if the problem persists as this might
quantrocket.realtime: ERROR File "/opt/conda/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 187, in reraise
quantrocket.countdown: ERROR be a bug'', ''error'': ''(psycopg2.OperationalError) FATAL: sorry, too many clients

We have different real-time collections along the day that we launch from the crontab service (some of them are active at the same time) and we get this error every day but at different times.

It can happen if you have a lot of real-time databases, because each will maintain a connection pool. How many databases do you have?

1 Like

Effectively, It turned out that we had a lot realtime databases from old executions that did not finish correctly. After deleting them, it works correctly. Thanks.