Getting "Too many connections" yet not consuming 50% of max_connections

We are running into an issue where the MySQL instance is returning “Too many connections”. The only resolution is a restart of MySQL. When it happened the second time I was logged into MySQL and the show processlist command listed 136 connections and max_connections is set to 500. Max_user_connections is not set for any user. We were not even hitting 50% of max_connections and this was happening for all users in the database including root connecting locally through a socket.

Sample of error.log
2024-04-29T16:47:34.642514Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:35.345191Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:36.015070Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:36.015137Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:38.825593Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:38.903911Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:38.903981Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:39.426766Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:39.853798Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:40.403982Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:40.404253Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:41.971452Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:42.880956Z 0 [Warning] [MY-000000] [Server] Too many connections
2024-04-29T16:47:43.889567Z 0 [Warning] [MY-000000] [Server] Too many connections

Can you try FLUSH HOSTS next time? This may be an incorrect message due to a particular host causing too many auth failures getting black-flagged.

Ran flush hosts and the process hung.

It was also happening on multiple host including remote and connecting locally through a socket. It is a very odd error.

are you running with skip-name-resolve?

skip_name_resolve = OFF