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

Reachability analyzer created incorrect report #9868

Closed
bodiam opened this issue Oct 12, 2024 · 4 comments
Closed

Reachability analyzer created incorrect report #9868

bodiam opened this issue Oct 12, 2024 · 4 comments
Assignees
Labels
tools Relating to Truffle Tools (CPUSampler, Coverage tool, etc)

Comments

@bodiam
Copy link

bodiam commented Oct 12, 2024

Describe GraalVM and your environment :

  • GraalVM version or commit id if built from source: openjdk version "23" 2024-09-17
  • CE or EE: CE
  • JDK version: JDK23
  • OS and OS Version: MacOS
  • Architecture: amd64
  • The output of java -Xinternalversion:
OpenJDK 64-Bit Server VM (23+37-jvmci-b01) for bsd-aarch64 JRE (23+37-jvmci-b01), built on 2024-08-22T11:26:48Z with clang Apple LLVM 14.0.3 (clang-1403.0.22.14.1)

Have you verified this issue still happens when using the latest snapshot?
You can find snapshot builds here: https://github.com/graalvm/graalvm-ce-dev-builds/releases

Describe the issue
I've created a reachability-metadata file, but it contains empty globs.

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. I used my repo, github.com/datafaker-net/datafaker
  2. I ran all the tests with the java agent
  3. The reachability file was created, but when using the library, GraalVM complains that I can have empty glob patterns

Expected behavior
A correct file

Additional context

I won't post the whole file since it's 22.000 lines long, but this is the incorrectly generated part:

  "resources": [
    {
      "glob": ".yml"
    },
    {
      "glob": "/.yml"
    },
    {
      "glob": "//_AL"
    },
    {
      "glob": "//_AR"
    },

@bodiam bodiam added the tools Relating to Truffle Tools (CPUSampler, Coverage tool, etc) label Oct 12, 2024
@selhagani selhagani self-assigned this Oct 14, 2024
@selhagani
Copy link
Member

@bodiam, thank you for sharing this with us! We'll take a look into this shortly and I'll make sure to keep you updated.

@selhagani
Copy link
Member

Hi @bodiam,

I'm not entirely sure what you mean by "I used my repo, github.com/datafaker-net/datafaker."

To reproduce the issue, I created a Maven project and added the Datafaker library. I then implemented some use cases for it in my code, after which I used the tracing agent to generate the reachability-metadata. The generated file was correctly populated, and I was able to build the native image without any issues.

Could you please provide the exact steps you followed to encounter the problem? That would help me assist you more effectively.

Thank you!

@bodiam
Copy link
Author

bodiam commented Oct 23, 2024

Hi @selhagani ,

My apologies for being unclear. I'm the maintainer of Datafaker, and I would like to generate a reachability-metadata.json file as part of the library, so that no users of Graal + Datafaker have to to that themselves.

To accomplish this, I ran all the unit tests of the Datafaker project and I enabled the GraalVM java-agent/reachability agent to collect all the info. Most of it was collected correctly, but it also generated configuration with the double slash // as above.

I have created the file as explained here: https://github.com/datafaker-net/datafaker?tab=readme-ov-file#native-image.

If I made a mistake in generating this file, please let me know, and I'll fix my tests or update my instructions.

Thanks for the help!

@selhagani
Copy link
Member

I’m unable to replicate the issue you’re encountering, as the generated file did not exhibit the behavior you described during my testing. While I’m unsure of the exact steps you’re following, here is the process I use in general:

  1. Run the following command to generate the configuration files:
    java -agentlib:native-image-agent=config-output-dir=META-INF/native-image -jar myJar.jar
  2. Build the native image with the generated configuration:
    native-image --no-fallback -H:ConfigurationFileDirectories=META-INF/native-image -jar myJar.jar

@bodiam bodiam closed this as completed Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Relating to Truffle Tools (CPUSampler, Coverage tool, etc)
Projects
None yet
Development

No branches or pull requests

2 participants