We have a Tomcat7 Java 11 application on which a few developers work in parallel. This has some debug ports exposed in DEV stability. Sometimes, a user might connect to the debug port and end up forgetting to close the connection, and leaves the connection open, with some active debug points causing the application to pause all processing which involves that flow.
I was wondering if the following options are possible:
- Use JMX or even custom Java code which can be exposed restfully on Tomcat to check is someone is actively debugging (to be clear, I don't mean if debug options are enabled, but if someone is actually connected to that port)
- Get username or some identification for the user. Maybe the machine from which connection request originated?
- Automatically close debug connection after some fixed time?
If you have app running on Linux
ss -tn src :debugPort
Peer Address:Port
you will find the host connected to your app.tcpkill ip host 192.168.1.2
to end the connection.