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

Rogue proxy/lambda entries in the agent captured reflect-config.json files #2990

Closed
aclement opened this issue Nov 17, 2020 · 5 comments
Closed
Assignees
Labels
bug native-image spring spring related issue
Milestone

Comments

@aclement
Copy link

Describe the issue
When collecting configuration via the agent, the reflect-config.json can sometimes contain entries that I'm not sure should be there. Entries for JDK proxies and entries for lambdas:

{
  "name":"com.sun.proxy.$Proxy34",
  "allDeclaredFields":true,
  "allDeclaredMethods":true,
  "methods":[
...
{
"name":"org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$HikariPoolDataSourceMetadataProviderConfiguration$$Lambda$347/0x0000000840241040",
  "allDeclaredFields":true,
  "allDeclaredMethods":true,

Steps to reproduce the issue
I am using graalvm-ce-java11-20.3.0-dev-20201112

  1. git clone https://github.com/spring-projects-experimental/spring-graalvm-native.git
  2. cd spring-graalvm-native/spring-graalvm-native-samples/batch
  3. mvn clean package
  4. mkdir -p graal/META-INF/native-image
  5. java -agentlib:native-image-agent=config-output-dir=graal/META-INF/native-image -jar target/batch-0.0.1-SNAPSHOT.jar
  6. app should terminate after a few seconds
    Review graal/META-INF/native-image/reflect-config.json see the unexpected entries.

Describe GraalVM and your environment:

  • graalvm-ce-java11-20.3.0-dev-20201112
  • OS: macOS Catalina
@vjovanov vjovanov added the spring spring related issue label Nov 17, 2020
@vjovanov vjovanov self-assigned this Nov 17, 2020
@vjovanov vjovanov added this to the 21.0 milestone Nov 17, 2020
@vjovanov
Copy link
Member

How would I verify that the image still works after I remove these inputs?

@vjovanov
Copy link
Member

After a discussion with @peter-hofer we agreed that the best solution is to:

  1. For lambdas try and introduce a stable name that would be valid across the agent and Native Image runs. We need this anyhow for serialization.
  2. For proxies, we should filter them out, but we should also allow all the methods and fields in proxies to be accessible by reflection. We would take this approach only if allowing access to proxies doesn't increase image size overly much.

This is not a blocker or a breaking feature so I am pushing it to 21.1. due to the complexity of the required change.

@vjovanov vjovanov modified the milestones: 21.0, 21.1 Dec 15, 2020
@aclement
Copy link
Author

Hey,

How would I verify that the image still works after I remove these inputs?

I'l include this for completeness for the future. Basically we would rebuild the app with that config on the class path and ensure it doesn't fall over. This is possible via:

  1. open compile.sh, where it supplies -cp $CP near the bottom, tweak that to -cp $CP:../../graal to add the agent generated config as input.
  2. Now run build.sh - this will run compile.sh and then automatically test the image according to what is in verify.sh

@Eng-Fouad
Copy link

Any updates regarding this issue?

@peter-hofer
Copy link
Member

@Eng-Fouad thanks for the reminder! Proxy classes have already been filtered for a while, and I have recently added filtering for lambdas too, which is part of 22.2: 18c276f
Please report if there are still issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug native-image spring spring related issue
Projects
None yet
Development

No branches or pull requests

4 participants