IntelliJ debugger no longer stops at breakpoints
Using IntelliJ Community Edition 2022.3.2 for Windows, I was debugging just fine until I decided to run some unit tests manually by going to the file in the proyect explorer, double clicking it and selecting "run".
After doing that, the remote JVM Debug I had been using for months is no longer working and i can´t seem to find a way to fix it.
Just to discard some possible causes i detail the following:
-
-Xdebug and -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n are in the Java Options tab of tomcatw.exe
-
CMD arguments for remote JVM are the following, -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000
-
Im using the exact same JDK installation for my webapp, IntelliJ and Tomcat
-
Tomcat console shows "Listening for transport dt_socket at address: 8000" whenever I run the debugger and it start with the correct parameters
Listening for transport dt_socket at address: 8000
08-Feb-2023 11:32:18.580 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Nombre de la versi├│n del servidor: Apache Tomcat/10.0.27
08-Feb-2023 11:32:18.583 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Oct 3 2022 14:18:31 UTC
08-Feb-2023 11:32:18.583 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log N├║mero de versi├│n de servidor: 10.0.27.0
08-Feb-2023 11:32:18.584 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
08-Feb-2023 11:32:18.584 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Versi├│n de Systema Operativo: 10.0
08-Feb-2023 11:32:18.584 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Arquitectura: amd64
08-Feb-2023 11:32:18.584 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk-17.0.4
08-Feb-2023 11:32:18.584 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 17.0.4+11-LTS-179
08-Feb-2023 11:32:18.585 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Vededor JVM: Oracle Corporation
08-Feb-2023 11:32:18.585 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Program Files\Apache Software Foundation\Tomcat 10.0
08-Feb-2023 11:32:18.585 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\Program Files\Apache Software Foundation\Tomcat 10.0
08-Feb-2023 11:32:18.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xdebug
08-Feb-2023 11:32:18.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
08-Feb-2023 11:32:18.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 10.0
08-Feb-2023 11:32:18.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 10.0
08-Feb-2023 11:32:18.592 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 10.0\temp
08-Feb-2023 11:32:18.593 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
08-Feb-2023 11:32:18.593 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 10.0\conf\logging.properties
08-Feb-2023 11:32:18.593 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
08-Feb-2023 11:32:18.594 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
08-Feb-2023 11:32:18.594 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
08-Feb-2023 11:32:18.594 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: exit
08-Feb-2023 11:32:18.594 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: abort
08-Feb-2023 11:32:18.595 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms128m
08-Feb-2023 11:32:18.595 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx256m
- I´m not using any plugins, just vanilla IntelliJ
My hypothesis is that running the unit test created another JVM or Java Project and the debugger attachs to it whenever I run it but I tried restarting my PC to kill all processes and did´t work. Also tried uninstalling Tomcat and IntelliJ because I notice that before running the unit test, it built the proyect and that´s something I never do using the IntelliJ Build Project tool, I always do it via CMD
请先登录再写评论。
Does the IDE connect to the remote process that you want to debug?
Do the breakpoints get the checkmarks once the debugger is connected?
Are you sure it's the correct Tomcat instance that indeed runs the code that you are trying to debug?
Use TcpView to ensure it's a correct Tomcat instance listening for debugger on port 8000.
Make a change in your code like adding a logging statement, put a breakpoint on this line, build/deploy the new app, restart Tomcat. Do you see this new message logged?
See if the issue can be reproduced with a new project. Try with the default IDE settings: File | Manage IDE Settings | Restore Default Settings...: https://i.imgur.com/kbrkC7w.png.
Does the IDE connect to the remote process that you want to debug? When running the debugger, the debugger console displays "Connected to the target VM, address: 'localhost:8000', transport: 'socket'" and the Tomcat console displays "Listening for transport dt_socket at address: 8000"
Do the breakpoints get the checkmarks once the debugger is connected? Yes, red dots with a white check
Are you sure it's the correct Tomcat instance that indeed runs the code that you are trying to debug? I only have one Tomcat instance in my PC, Tomcat10.
Make a change in your code like adding a logging statement, put a breakpoint on this line, build/deploy the new app, restart Tomcat. Do you see this new message logged? Did not add a logging statement but i switch branches in my proyect wich affects the behaviour of my webapp and upon building and deploying the changes where there
As a last resort, I tried uninstalling Tomcat and IntelliJ, deleting the proyect folder and cloning it again from Github and restoring IntelliJ default settings (File | Manage IDE Settings | Restore Default Settings) but that didn´t work
Is there any more information I can provide?
Please share a screenshot of where the breakpoint is placed and how they look like after debugger is connected. How do you know that this specific code at the breakpoint is actually executed? Please try with the logging statement to make sure it works.
Try debugging with the command line jdb tool. Does it work?
What are the breakpoint properties? Make sure Suspend option is enabled.
I'm starting to think this might be a bug of some sort, but it caught my attention that it persists even after uninstalling IntelliJ so my question is, does IntelliJ leave something behind after the uninstall process? When uninstalling, I checked the options to erase everything and even after installing it again I cleaned all the cache
Answering your questions...
As I said, im 100% sure the code executes because the debugger was working just fine, stopping at the breakpoints I have, until it suddenly didn't without any change to the code. My best guess it that running that unit test (by selecting it in proyect explorer and clicking run) messed something up and after doing some digging i might have find where the problem is.
This is the source code of the routine my webapp is executing and I am trying to debug
Along the calling tree, the "fromJsonString" calls a method of name convertObjectTo where I have breakpoints just at the start
The above code seems to never execute because the logging messages appear nowhere but here is where I found that when manually running a unit test, IntelliJ build the proyect and runs the test over the compiled code thats product of that build as shown below
Finally, what i want to say is that when I run the remote JVM debug it is being attached to that proyect it built to run the unit test. Below is something that migth be a hint of that
If you check the routine im trying to debug, httpContext.GX_msglist is a method present in that routine and here is being detected by the debugger but notice that it says that there are multiple sources available for that code. In my case the correct one is the third one (com.genexus.gxclassR:2.10-SNAPSHOT (gxclassR:2.10-SNAPSHOT.jar)) so i have the following two questions
Hope I was clear enough and provided sufficent information to fix the problem, thanks for the support
Fix your build/dependencies to avoid duplicate classes in the classpath. There is no way for the IDE to know which copy of the class gets loaded.
This happens sometimes, I hit CTRL+SHIFT+F9 (recompile) and the breakpoints start working again!
My remote debugger just stopped working and couldn't figure out why.
Below is my debugger config and I can see the ‘Debugger attached’ log on console.
After debugger gets attached to the remote process, there is just red mark at the breakpoint, but no checkmark.
Here is my IntelliJ version
I hope this will be a sufficient info. Appreciate any help. Thanks!!
Please submit a ticket for WebStorm support: https://intellij-support.jetbrains.com/hc/requests/new .
The original thread here is about the Java debugger.
It is a big problem, I have to restart the IDE 5x a day.
Hello Lenny,
Please submit a ticket for IDEA support: https://intellij-support.jetbrains.com/hc/requests/new for deeper investigation.