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

enhanced constructor failed #1744

Open
lhh-yeah opened this issue Jan 7, 2025 · 4 comments
Open

enhanced constructor failed #1744

lhh-yeah opened this issue Jan 7, 2025 · 4 comments
Assignees
Labels
Milestone

Comments

@lhh-yeah
Copy link

lhh-yeah commented Jan 7, 2025

Hi, I'm facing a difficult problem and hope to get some help, thank you.

Problem Description:
Two Byte Buddy agents are both enhancing the constructor of the same class, but the second one fails.
net.bytebuddy.pool.TypePool$Resolution$NoSuchTypeException: Cannot resolve type description for com.demo.BizFoo$auxiliary$nSryTzXN

#1434
I found an issue that is the same. However, the mentioned solution may have risks.

#1419
There is another issue that mentions this problem, and you commented that it would be resolved, but I tried the latest version and the issue still persists.

#1071
#1198
The solution provided by this issue is to save the bytecode generated by the previous agent and hand it over to the next agent for use. However, it is necessary to modify the agent, since it is not self-developed, the maintenance cost is relatively high.

@raphw
Copy link
Owner

raphw commented Jan 9, 2025

Ideally, you would switch over to Advice, what avoids the problem. Otherwise, you would need to register a listener in the one agent and extract the provided byte[] array to store it somewhere. Then you would also need to register a ClassFileLocator in the other agent that looks up this resource.

@raphw raphw self-assigned this Jan 9, 2025
@raphw raphw added the question label Jan 9, 2025
@raphw raphw added this to the 1.11.15 milestone Jan 9, 2025
@lhh-yeah
Copy link
Author

Change to advice mode, the cost of transformation is too high.
Getting bytecode through listener and class is feasible, and if there is no other way, I should choose.

#1434
image
So far, asynchronous retransformClasses is the least modification, Is there any risk?
but I still don't understand why synchronous retransformClasses will fail. Can you tell me the more information?

@raphw
Copy link
Owner

raphw commented Jan 10, 2025

How is advice more expensive? Are you reusing the Advice instance?

@lhh-yeah
Copy link
Author

I'm sorry, maybe my expression was not accurate.
What I really meant to say is that if I switch to advice, I would have to change a lot of code.
Moreover, the other agent is the SkyWalking agent, which doesn't use advice. It's simply not possible to make significant modifications to it.

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

No branches or pull requests

2 participants