22

I sometimes am forced to work away from my office, meaning that I need to VPN into my lab. I've noticed that remote-debugging with Eclipse in this situation is horrendously slow. Slow to the point where it takes 5-7 minutes for the debugger to attach to the remote jvm. After connection, stepping through breakpoints/lines can take 20-30 seconds each time, and it routinely just drops the connection, making me have to start over again.

Can anyone explain why this is, even if there is no available solution? My latency through the VPN isn't nearly what one would expect given the behaviour of the remote-debugger. I do all kinds of other stuff over the VPN with minimal lag/obstruction.

I'm really struggling to understand why the remote-debugger is so afflicted by the VPN, when basically every other network operation is fine.

Thanks,

user3062946
  • 682
  • 1
  • 6
  • 17
  • Java debugger may be very chatty ; that is affected by VPN. – Jayan Mar 17 '15 at 08:03
  • 1
    You may setup machine in office with IDE and connect to that over VPN. That could be faster as debugger communication is now local. – Jayan Mar 17 '15 at 08:05
  • It will really help if you include more information about your environment; particularly what version of Eclipse you are using for this. – hfontanez Mar 17 '15 at 18:19
  • I'm using Indigo, although I've had the same problem in previous versions as well. – user3062946 Mar 17 '15 at 19:07
  • Remote debugging for a local running application is not that fast, now doing the same thing over VPN will be terribly slow because for that to work at normal speeds you should have a very good bandwidth in your VPN, only then things can be normal. There's usually a lot of traffic between your app server and your source code in eclipse when you do remote debugging – Arkantos Mar 18 '15 at 16:27
  • 1
    I suggest you add more logs to your source code, deploy your app again in VPN and try to analyze those logs. You might have to do some restarts but it's way better than struggling with remote debugging in your case :) – Arkantos Mar 18 '15 at 16:29

4 Answers4

17

Thanks for attempting to help, guys. Luckily a colleague of mine, plagued by the same problems, did a deep dive into it. From my colleague's correspondence:

"I set up a proxy sitting between my Eclipse and my VM which printed out command codes from JDWP packets my Eclipse was sending to my VM. http://docs.oracle.com/javase/8/docs/platform/jpda/jdwp/jdwp-protocol.html page explained me what those commands meant. What I saw was: every time I stepped through the code Eclipse was sending dozens and dozens of "thread monitor" - related commands to VM. They are related to the following VM capabilities: canGetMonitorInfo, canGetCurrentContendedMonitor, canGetOwnedMonitorInfo, canGetMonitorFrameInfo"

Those capabilities are causing the insane amount of lag. He has cooked up a solution that forcably disables those capabilities, and the usability of the debugger has skyrocketed. Obviously the thread-monitoring functionality of the remote debugger no longer works, but given how unusable the remote debugging was previously, this is a great compromise.

I'll attempt to find out what exactly he did to disable the thread-monitor capabilities.

user3062946
  • 682
  • 1
  • 6
  • 17
  • 9
    Any luck finding out how to disable the thread-monitor capabilities? – Aaron Blenkush Mar 23 '15 at 22:26
  • 7
    I did not explicitly disable the VM capabilities mentioned, but I did disable the "Show Monitors" option in the settings and debugging got substantially faster. screenshot: http://postimg.org/image/w6gkc0nmf/full/ – Mike DaCosta May 20 '15 at 19:43
  • the image is not available anymore please describe where to disable it – marcobazzani Jan 16 '16 at 11:14
  • 2
    In Debug View, click on the bottom facing triangle (third last icon on right). Then select Java > "Show Monitors". – Manish Apr 29 '16 at 12:27
  • @MichelDaviddaCosta Your suggestion is very helpful. My initial connection itself could be made in a few seconds instead of several minutes. However, if you have a lot of threads in your JVM, there seems to other operations that slow it down, but definitely a good option to know about. – haridsv Feb 16 '17 at 17:00
  • @MichelDaviddaCosta This answer actually is not very helpful, as it doesn't have any solution and accordingly I didn't vote up. However, I did vote up your comment. It actually deserves to be a standalone answer and should be accepted as the best answer. – haridsv Feb 16 '17 at 17:03
  • thank you for your answer, however it didn't work for me, how can we hack this? – Fernando Gabrieli Jun 05 '17 at 21:43
  • Eclipse 2019-06 is still super slow when remote debugging. Looks like the Eclipse still hasn't fixed the problem. Amazing. – T3rm1 Aug 22 '19 at 09:05
  • And Eclipse 2019-12 is also in fact unusable for remote debugging over VPN, even with disabled Show Monitors. Very sad... – I4004 Jan 10 '20 at 21:26
  • This is great, my remote debug is super fast now. Just to add in there are multiple down arrows options available in eclipse debug perspective. The option where change need to be done is available under Debug Tab > Down Arrow icon > Java > Show Monitor – Bikram Jan 24 '20 at 01:01
12

Disabling Show monitor indeed helped me.
The Bottom facing triangle is difficult to spot in debug perspective. So Just posting the image which is missing in the link.

enter image description here

peeyush
  • 2,841
  • 3
  • 24
  • 43
  • Thanks for the tip, this was super helpful. – Bikram Jan 24 '20 at 00:50
  • The user interface has probably changed. In Eclipse version 2021-12, to get to this option you should now click on the 3 dots in the "Debug View" window, then "Java", then "Show Monitors" – DAB Nov 17 '21 at 16:22
0

From very light testing of a pretty large project (almost 100 subprojects, ping times ~200-300ms), Netbeans seems to be doing ok in comparison with Eclipse.

You can step and it takes few seconds to update and attaches in < 1 min.

It's of course annoying to not be able to use Eclipse, but it is a GUI and as such way better than plain JDB.

Anjo
  • 71
  • 1
  • 3
-1

Have you tried this? http://www.gontu.org/how-you-can-debug-a-remote-java-application/

It sounds like you need to set this up in order to debug your application through VPN. This, by the way, has been answer as well in this Stack Overflow posting.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
hfontanez
  • 5,774
  • 2
  • 25
  • 37
  • 1
    Sorry, I'm not sure you understand the question. I can remotely debug the application, all of the setup is fine. The latency is just obstructive, and I cannot figure out why remote debugging is so horrendously affected by this, while nothing else is. – user3062946 Mar 17 '15 at 17:13
  • @hfontanez problem is latency not configuration – Fernando Gabrieli May 16 '17 at 19:06
  • @FernandoGabrieli the OP already indicated that two years ago. – hfontanez May 17 '17 at 01:27