Java.lang.ClassFormatError: Duplicate interface name "org/apache/skywalking/apm/agent/core/plugin/interceptor/enhance/EnhancedInstance" #6172
Labels
agent
Language agent related.
bug
Something isn't working and you are sure it's a bug!
core feature
Core and important feature. Sometimes, break backwards compatibility.
Milestone
Please answer these questions before submitting your issue.
Question
Bug
Which version of SkyWalking, OS, and JRE?
SkyWalking version:8.4.0-SNAPSHOT,
jdk version:jdk1.8
os version: mac 10.14.2
Which company or project?
What happened?
If possible, provide a way to reproduce the error. e.g. demo application, component version.
When there is an app to use skywalking, application report this error, and crash.
link issue,#2647, #4949, #5077, #5673
Requirement or improvement
Troubleshooting:
Therefore, I dumped the bytecode of the two cglib dynamic proxy classes enhanced by skywalking and decompiled before the exception caused the application to exit.
![image](https://user-images.githubusercontent.com/16839929/104180579-524ba600-5448-11eb-8b58-f778b743ef04.png)
![image](https://user-images.githubusercontent.com/16839929/104180656-70190b00-5448-11eb-8bd7-e5505227b65f.png)
the first time:
the second time:
From the above, we can know that cglib will nest in the process of doing dynamic proxy. When the first level of nesting is enhanced by skywalking, this class has implemented the EnhancedInstance class of skywalking, so it enters:
org.springframework.aop.framework.CglibAopProxy#getProxy(java.lang.ClassLoader)
Since rootClass is already an EnhancedInstance class that implements skywalking, cglib is used to generate a dynamic proxy class again. When the generated dynamic proxy class triggers the skywalking bytecode interception process, it implements the EnhancedInstance interface, so the verification of this class fails and an exception occurs. App exit
Solve the problem:
It can be solved by setting the agent.is_open_debugging_class parameter of skywalking.config to true. This parameter sets whether bytebuddy performs bytecode verification.
Before the original isObjectExtended judgment, add another isAssignableTo to judge whether the current class is a subclass of EnhancedInstance
The text was updated successfully, but these errors were encountered: