1

When I try to login to the PostgreSQL database I get the error "FATAL: sorry, too many clients already". I checked the number of the connections from another already opened session with the sql select sum(numbackends) from pg_stat_database where datname = '$dbname';, the number is only 13. But the max_connections is set to 100. How can the error happen when the max_connections is not reached?

The PostgreSQL server is a read replica instance running in the Docker container. I've verified the max_connections value by running show max_connections;. Also, the error seems random to me because sometimes I tried to open as many connections as possible to test the limit and it can open 100 connections then throw the error after that.

ailionx
  • 21
  • 6

1 Answers1

1

It turns out the reason was that the IO was occupied fully and it was almost not responding. Then it threw the error "FATAL: sorry, too many clients already" despite the max connections was not reached.

ailionx
  • 21
  • 6