| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I think this is a general change, rather than fixing Jedis, right? |
Sorry, something went wrong.
Yes, any class that enhances a method from a parent class will have a similar error. |
Sorry, something went wrong.
|
I want to create an abstract test class that makes it easy to test re-transform in a plug-in module, such as JedisInstrumentationTest. Because of using SkyWalkingAgent#installClassTransformer() method in apm-agent, it can not put in bytebuddy-patch module, a bit painful, any suggestions? |
Sorry, something went wrong.
Does this indicate, you are actually testing agent, rather than patch? |
Sorry, something went wrong.
Actually, test re-transforming of plugin |
Sorry, something went wrong.
|
Yes, then this is a test scenario, I think you could write a plugin test to verify this. It doesn't matter it is about bytebuddy patch or not. |
Sorry, something went wrong.
|
Write a plugin test to test all plugin maybe difficult, it need to load many classes and some of them are conflicted. |
Sorry, something went wrong.
Then how do you prefer to test this? If there isn't a real agent running. |
Sorry, something went wrong.
I found it does not need to test in real agent, it just need test by re-transform the enhanced class after plugin enhance. Check about JedisInstrumentationTest. |
Sorry, something went wrong.
|
I did a quick read on JedisInstrumentationTest. Generally, you could write mock classes in the agent repository, and redo the UTs, right? It doesn't need to be inside Jedis plugin. |
Sorry, something went wrong.
|
@kylixs It seems that Jedis is fine, but there will still be a TypeNotPresentException with watch org.apache.kafka.clients/product.KafkaProducer send - x 1 |
Sorry, something went wrong.
I agree that we should introduce some-how "general" way to test the re-transform mechanism like our E2E for plugins. |
Sorry, something went wrong.
@xyyz150 It works correctly in windows11 + jdk 17. Your environment? Error details? |
Sorry, something went wrong.
|
mac+jdk17.Error details: |
Sorry, something went wrong.
Sorry, something went wrong.
Please check error details in file: ${user home}/logs/arthas.log |
Sorry, something went wrong.
I've confirmed that Kafka issue still exists while Redis issue has been resolved.
Error logs shown in arthas.log, 2023-12-22 11:32:55 [arthas-command-execute] INFO c.t.arthas.core.advisor.Enhancer -enhance matched classes: [class org.apache.kafka.clients.producer.KafkaProducer] 2023-12-22 11:32:55 [arthas-command-execute] WARN c.t.arthas.core.advisor.Enhancer -transform loader[org.springframework.boot.loader.LaunchedURLClassLoader@8c46918]:class[org/apache/kafka/clients/producer/KafkaProducer] failed. java.lang.TypeNotPresentException: Type org/apache/kafka/clients/producer/KafkaProducer$$sw$auxiliary$o9jqgj1 not present at com.alibaba.deps.org.objectweb.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:1051) at com.alibaba.bytekit.asm.ClassMetaClassWriter.getCommonSuperClass(ClassMetaClassWriter.java:43) at com.alibaba.deps.org.objectweb.asm.SymbolTable.addMergedType(SymbolTable.java:1202) at com.alibaba.deps.org.objectweb.asm.Frame.merge(Frame.java:1300) at com.alibaba.deps.org.objectweb.asm.Frame.merge(Frame.java:1198) at com.alibaba.deps.org.objectweb.asm.MethodWriter.computeAllFrames(MethodWriter.java:1611) at com.alibaba.deps.org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1547) at com.alibaba.deps.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:767) at com.alibaba.deps.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:647) at com.alibaba.deps.org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:468) at com.alibaba.bytekit.utils.AsmUtils.toBytes(AsmUtils.java:80) at com.taobao.arthas.core.advisor.Enhancer.transform(Enhancer.java:256) at com.taobao.arthas.core.advisor.TransformerManager$1.transform(TransformerManager.java:51) at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244) at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188) at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541) at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native Method) at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:169) at com.taobao.arthas.core.advisor.Enhancer.enhance(Enhancer.java:446) at com.taobao.arthas.core.command.monitor200.EnhancerCommand.enhance(EnhancerCommand.java:173) at com.taobao.arthas.core.command.monitor200.EnhancerCommand.process(EnhancerCommand.java:120) at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.process(AnnotatedCommandImpl.java:82) at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.access$100(AnnotatedCommandImpl.java:18) at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:111) at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:108) at com.taobao.arthas.core.shell.system.impl.ProcessImpl$CommandProcessTask.run(ProcessImpl.java:385) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: java.lang.ClassNotFoundException: org.apache.kafka.clients.producer.KafkaProducer$$sw$auxiliary$o9jqgj1 at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592) at com.taobao.arthas.agent.ArthasClassloader.loadClass(ArthasClassloader.java:34) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:467) at com.alibaba.deps.org.objectweb.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:1049) ... 31 common frames omitted 2023-12-22 11:32:55 [arthas-command-execute] INFO c.t.arthas.core.advisor.Enhancer -Success to batch transform classes: [class org.apache.kafka.clients.producer.KafkaProducer] |
Sorry, something went wrong.
|
After discussing with @kylixs, we've confirmed that this PR works well with Arthas 3.6.7, but not versions > 3.6.7 (including 3.7.1, 3.6.8 etc.) |
Sorry, something went wrong.
There was a problem hiding this comment.
This patch LGTM while we could still improve test coverage (probably in the following PRs)
Sorry, something went wrong.
|
Could someone submit a ticket to Arthas? I think they could know this quickly as this is just a diff between versions. |
Sorry, something went wrong.
Submitted here alibaba/arthas#2774 |
Sorry, something went wrong.
|
@kylixs Is this possible to makes tests in agent module, rather than Jedis? And we need to fix change logs, this is not a Jedis fix, but a retransform enhancement, and Arthes compatible fix |
Sorry, something went wrong.
Fixed: alibaba/arthas#2775 |
Sorry, something went wrong.
I prefer to do a separate module ( agent-retransform-tests ), because there are a lot of plugin-related dependencies. The downside is that we need to maintain some associated dependencies when the plug-in changes. |
Sorry, something went wrong.
|
If that is the case, let's keep the test in the Jedis plugin. But let's make changes.md and PR title accurate. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fix re-transform bug when enhanced class proxy parent method
For example, re-transform Jedis failed with Arthas : apache/skywalking#11651
What happened
Open redefine log by:
Analyze with javap -p and compare the bytecode before and after retransform, it is found that the field name of the proxy method changes.
Found the number of declaration methods returned during retransform is increased and not in the same order. The extra methods comes from the parent class, and the methods are evaluated in a different order each time.
For example, the method get(byte[]) of redis.clients.jedis.BinaryJedis will be added to redis.clients.jedis.Jedis after jedis plugin is enhanced.
How to fix it