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

MatchableClassFileTransformerDispatcher not apply on All Classes #3687

Open
jsxiaoshunzi opened this issue Jan 8, 2018 · 9 comments
Open

Comments

@jsxiaoshunzi
Copy link

Description

I wrote KafkaConsumer plugin,then a very strange thing happens.
I have print out all the MatchableClassFileTransformerGuardDelegate . And I can see 'SubscriptionState' class has a MatchableClassFileTransformerGuardDelegate transformer {matcher=DefaultClassNameMatcher{org.apache.kafka.clients.consumer.internals.SubscriptionState}, transformCallback=com.navercorp.pinpoint.plugin.kafka.KafkaClientPlugin$1@3dd6db4a}
But The transformer has not been applied. (Noexception happens of course)
Similar like https://stackoverflow.com/questions/34285862/java-agent-transform-not-applied-on-all-classes

@jsxiaoshunzi
Copy link
Author

It confused me several weeks

@jsxiaoshunzi
Copy link
Author

image
As the above picture,I print out all instrument loaded class. It does contains 'SubscriptionState'.

@jsxiaoshunzi
Copy link
Author

org.apache.kafka.clients.consumer.KafkaConsumer,/E:/Localrepository/org/apache/kafka/kafka-clients/0.10.1.1/kafka-clients-0.10.1.1.jar,sun.misc.Launcher$AppClassLoader@4145f572
org.apache.kafka.clients.consumer.internals.SubscriptionState,/E:/Localrepository/org/apache/kafka/kafka-clients/0.10.1.1/kafka-clients-0.10.1.1.jar,sun.misc.Launcher$AppClassLoader@4145f572

@Xylus
Copy link
Contributor

Xylus commented Jan 9, 2018

Hi @jsxiaoshunzi
Could you check if SubscriptionState's TransformCallback.doInTransform(...) is executed? You could set a breakpoint to check, or look for the transform log (debug) for something like the following:

[DEBUG](c.n.p.p.BaseClassFileTransformer   :xx ) [transform] classLoader:sun.misc.Launcher$AppClassLoader@xxxxxxx className:org.apache.kafka.clients.consumer.internals.SubscriptionState transformer:...

Also, is it just SubscriptionState that is not being transformed? or are other kafka classes you're trying to modify not getting transformed as well?

@jsxiaoshunzi
Copy link
Author

jsxiaoshunzi commented Jan 12, 2018

@Xylus
Thank you for your answer. I did put some log in SubscriptionState's TransformCallback.doInTransform().
KafkaConuser and SubscriptionState have the same classLoader. The strange things is KafkaConsumer has been transformed ,but SubscriptionState has not been transformed. The strangest things is SubscriptionState class has not enter the ClassFileTransformer,and I did find SubscriptionState has a transformer. But if I put "Class.forName(SubscriptionState )" in my agent service Code,It works fine.
image

@jsxiaoshunzi
Copy link
Author

jsxiaoshunzi commented Jan 12, 2018

@Xylus
I give you the source code. I really can't find the bug . Thanks!

src.zip

@jaehong-kim
Copy link
Contributor

@jsxiaoshunzi
Please put plugin source and test code in PR

@jsxiaoshunzi
Copy link
Author

@jaehong-kim
Hi,It is just test case , not for others peoples's use. The phenomenon is very strange. So I ask for help

@zlp1992
Copy link

zlp1992 commented Mar 18, 2021

@jsxiaoshunzi Is this solved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants