If you run a java process with arguments -Xdebug -agentlib:jdwp=transport=dt_socket,suspend=n,server=y,address=9000
, the process stops listening on the port once the debugger attaches to it. Then, once the debugger detaches, you can’t connect to it again. Is there any way to attach the debugger once it has been detached? Or is there a jdwp proxy server that is always attached to the process and allows the debugger to attach and detach at will?
Short answer is yes, you should be able to just reattach. There should be no problems doing this. There might be a race condition if multiple applications try to bind to the same port during detach/attach, but I don't see any other possible issues.