We have an enterprise geodatabase (AWS Aurora, postgres) that has a significant number of sessions and locks (10,000+). These sessions and locks date back to 8+ months ago. These tables and feature classes are only accessed by cached map services from a multi-machine ArcGIS Server site. All of these map services have been set to use "shared services" in the pooling. Theoretically if everything maxed out we would expect to see 200 concurrent connections to the database via these services.
We have tested these services in our dev environment using dedicated pooling and cannot replicate these persistent lock issues.
Has anyone else noticed that shared services from a multi-machine ArcGIS Server site not dropping the connection to the database? Our assumption is that when the service is recycled it never truly drops the connection. This is somewhat justified by Aurora never showing 0 connections to the database as there is always the minimum threshold as indicated by our shared service pooling size.
update
We have been able to replicate the schema locks persisting after the service has been stopped in our dev environment. Only changing the number of shared instances for the ArcGIS Server site cleared the locks.