Reachability analyzer created incorrect report
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
- I used my repo, github.com/datafaker-net/datafaker
- I ran all the tests with the java agent
- 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, thank you for sharing this with us! We'll take a look into this shortly and I'll make sure to keep you updated.
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!
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!
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:
- Run the following command to generate the configuration files:
java -agentlib:native-image-agent=config-output-dir=META-INF/native-image -jar myJar.jar - Build the native image with the generated configuration:
native-image --no-fallback -H:ConfigurationFileDirectories=META-INF/native-image -jar myJar.jar