1

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?
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Sahil Agarwal
  • 142
  • 1
  • 8
  • Possible, perhaps.. You will have to be willing go some lengths to create this custom behavior. Don't you think its easier to be more thorough in closing debug connections and make some agreements about this with the other developers? I – SnowmanXL Oct 08 '20 at 09:51
  • Ideally yes, we should close out the debug thread. I was hoping for some way to validate if someone is running remote debug, that's it – Sahil Agarwal Oct 13 '20 at 14:31
  • Were you able to find an answer for this? – Bageshwar Pratap Narain Aug 19 '21 at 06:34

1 Answers1

1

If you have app running on Linux

  • Go to terminal,
  • Run ss -tn src :debugPort
  • Under Peer Address:Port you will find the host connected to your app.
  • Then use tcpkill ip host 192.168.1.2 to end the connection.
kiner_shah
  • 3,939
  • 7
  • 23
  • 37