Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvocationTargetException when debugging after upgrading to IntelliJ IDEA 2024.3 #615

Closed
tyjuji opened this issue Nov 19, 2024 · 5 comments

Comments

@tyjuji
Copy link

tyjuji commented Nov 19, 2024

I managed to setup HotswapAgent and got it running last week.
However, after upgrading to IntelliJ IDEA 2024.3, from 2024.2.4, I would receive the following error when debugging:

C:\Users\tyjuji\IdeaProjects\apache-tomcat-9.0.96\bin\catalina.bat run
Using CATALINA_BASE:   "C:\Users\tyjuji\AppData\Local\JetBrains\IntelliJIdea2024.3\tomcat\30152101-a7db-4ec9-ab1e-1ffe10744bee"
Using CATALINA_HOME:   "C:\Users\tyjuji\IdeaProjects\apache-tomcat-9.0.96"
Using CATALINA_TMPDIR: "C:\Users\tyjuji\IdeaProjects\apache-tomcat-9.0.96\temp"
Using JRE_HOME:        "C:\Repos\jbrdcevm11"
Using CLASSPATH:       "C:\Users\tyjuji\IdeaProjects\apache-tomcat-9.0.96\bin\bootstrap.jar;C:\Users\tyjuji\IdeaProjects\apache-tomcat-9.0.96\bin\tomcat-juli.jar"
Using CATALINA_OPTS:   ""
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
[2024-11-19 11:07:57,711] Artifact GUSCUST00005: Waiting for server connection to start artifact deployment…
Connected to the target VM, address: '127.0.0.1:60684', transport: 'socket'
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.VerifyError: Catch type is not a subclass of Throwable in exception handler 46
Exception Details:
  Location:
    org/hotswap/agent/util/Version.version()Ljava/lang/String; @46: astore_0
  Reason:
    Type 'java/io/IOException' (constant pool 12) is not assignable to 'java/lang/Throwable'
  Bytecode:
    0000000: bb00 0259 b700 034b 1204 1205 b600 064c
    0000010: 2a2b b600 072b b600 082a 1209 b600 0ac7
    0000020: 0008 120b a700 092a 1209 b600 0ab0 4b12
    0000030: 0db0                                   
  Exception Handler Table:
    bci [0, 45] => handler: 46
  Stackmap Table:
    append_frame(@39,Object[#2],Object[#31])
    same_locals_1_stack_item_frame(@45,Object[#32])
    full_frame(@46,{},{Object[#12]})

	at org.hotswap.agent.HotswapAgent.premain(HotswapAgent.java:66)
	... 6 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
Starting HotswapAgent 'C:\Repos\jbrdcevm11\lib\hotswap\hotswap-agent.jar'
Disconnected from the target VM, address: '127.0.0.1:60684', transport: 'socket'
Disconnected from server

I don't know enough about the instrumentation to figure out what the error is, however, I can see in the release notes for 2024.3, that there have been changes to the standard hotswap. Perhaps there's a conflict here?
I have downgraded to 2024.2.4 again, and HotswapAgent works once more.

My setup:
IntelliJ IDEA Ultimate 2024.3
My project is language level 11
JDK: https://cache-redirector.jetbrains.com/intellij-jbr/jbr_dcevm-11_0_16-windows-x64-b2043.64.tar.gz
from https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr11_0_16b2043.64
HotswapAgent 2.0.1 jar added to lib/hotswap in the JBR.
Tomcat 9.0.96
VM Options: "-Dnashorn.args=--no-deprecation-warning -XX:+AllowEnhancedClassRedefinition -XX:HotswapAgent=fatjar"
If I run the project without "-XX:+AllowEnhancedClassRedefinition -XX:HotswapAgent=fatjar", then debug starts just fine in 2024.3.

@jorgheymans
Copy link

Seeing this as well after 2024.3 upgrade.

@gejun123456
Copy link
Contributor

intellij 2024.3 bundled debugger agent seems conflicting with hotswapAgent.
related issue: JetBrains/debugger-agent#9.

@skybber
Copy link
Contributor

skybber commented Nov 19, 2024

New debugger agent is redefining core classes from JDK (can be seen by -Xlog:redefine+class=info) . Redefinition of core classes is not fully supported in dcevm11 now. So it can be fixed either in dcevm11 or turning off redefinition of JDK classes on debug agent side.

@gejun123456
Copy link
Contributor

provide an vm option on debug agent side like -DdisableRedefineJdkClasses=true seem to be the fast way to fix this. java8 also has issues.

@skybber
Copy link
Contributor

skybber commented Nov 19, 2024

The current workaround is to disable the "Instrumenting Agent" option. To do this, navigate to "Build, Execution, Deployment" → "Debugger" → "Async Stack Traces" and uncheck the "Instrumenting agent".

@skybber skybber closed this as completed Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants