What are you looking at to claim the number of connections is under 600? Maybe there's some disconnect between what you're measuring and what the database thinks.
A different line of thought is that ProcArray slots can be consumed by things that aren't client connection processes, in particular (1) parallel-query workers (2) autovacuum workers Looking into pg_stat_activity when you see this issue might help clarify that.
Sorry, I could have been clearer - pg_stat_activity is what I'm looking at - I'm recording connection info from here every 15 seconds (from a superuser account so I don't get locked out). It never peaks above 300 (in fact when the incident happens no new connections can come in so it falls to around 100) - yet I'm seeing the log lines claim that I'm still hitting 597 (600 - 3 reserved).
If I measure from `ps -ef | grep postgres` and look at the connections then I can see that with the startup connections I am hitting this limit.
So client processes which are listed to the OS as "startup" ARE counted towards the 597 connections, but are NOT reported in pg_stat_activity
James
The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.