title: Getting "FATAL: sorry, too many clients already" when the max_connections number is not reached
body: <p>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 <code>select sum(numbackends) from pg_stat_database where datname = '$dbname';</code>, 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?</p>
  
  <p>The PostgreSQL server is a read replica instance running in the Docker container. I've verified the max_connections value by running <code>show max_connections;</code>. 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.</p>