Skip to content

[GraalVM] Question: A few GraalVM supporting questions #8174

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

Open
ziyilin opened this issue Jan 9, 2025 · 4 comments
Open

[GraalVM] Question: A few GraalVM supporting questions #8174

ziyilin opened this issue Jan 9, 2025 · 4 comments
Assignees
Labels

Comments

@ziyilin
Copy link

ziyilin commented Jan 9, 2025

Hi DD team, you did a great job to support building agent into GraalVM native image. DD's current agent support is very concise and user friendly. I'm working with GraalVM team to provide supports for Java agent in GraalVM, and deeply inspired by your work. For now, the premain support has been merged into GraalVM. Hopefully you don't need to instrument GraalVM framework in the future.

Meantime, I'm interested in how you tackled with a few technical bottlenecks.

  1. JDK class transformation problem.
    a. Build time interference: When agent is attached at native image build time, it may transform JDK classes that are used by GraalVM building process, resulting unpredicted building time behaviors. Our solution is to introduce a proxy agent that filters transformation of JDK and GraalVM classes out, and forward other transformations to the actual agent. How did DD solve this problem?
    b. Runtime invalidation: GraalVM has modified some JDK classes with its substitution mechanism. If a JDK class is transformed by agent and substituted by GraalVM at the same time, the agent transformation could be invalidated by GraalVM substitution. How did DD solve this problem?

  2. Agent dependencies problem. Agent's own dependency classes are shaded at agent packaging time, and loaded at runtime by agent's special classloaders. GraalVM loads all classes to compile by NativeImageClassLoader by reading class paths specified by native-image's -cp option. Our current solution is to manually package the agent's dependencies into a standalone jar and append it to the native-image's class path. I'm curious how DD managed to let GraalVM know how to load the agent's shaded dependencies.

Thank you very much.

@mcculls mcculls self-assigned this Jan 21, 2025
@mcculls
Copy link
Contributor

mcculls commented Jan 21, 2025

Hi @ziyilin - thanks for the update and questions, I'll write up what worked for us and what didn't

@mcculls
Copy link
Contributor

mcculls commented Feb 20, 2025

Hi @ziyilin apologies, been a busy start to the year - still working on writing this up, but hope to get something to you soon

@ziyilin
Copy link
Author

ziyilin commented Feb 21, 2025

@mcculls Thanks for the heads up. Hope to read your writings soon.

@ziyilin
Copy link
Author

ziyilin commented Mar 5, 2025

@mcculls Would you mind having an online meeting sometime to discuss this topic? There is another colleague of mine who is working on java agent is related with this topic.

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

3 participants