I attached to this mail patch which is fixing both problems: correctly reports error to the client and calculates number of idle clients).
Yes, this works much better with max_sessions=1000. Now it's handling the 300 connections on the small server. n_idle_clients now looks accurate with the rest of the stats here.