-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
"Detected a ZipFile object in the image heap." but object is from graalvm svm #4797
Comments
Hi, Thank you for reporting this, we will take a look into it and get back to you |
I followed the instructions to reproduce and the build stops at: |
Just remove |
Any update on this issue, I am experiencing the same using the same version of GraalVM. I have 4 modules causing the issue:
|
I'm experiencing the same problem on 22.2 and 22.3. 22.1 works flawlessly. Looking at the traces I think that this is some kind of a bug in native-image because I only see its codepaths there.
|
Ok, in my case this was caused by the rules for /~https://github.com/classgraph/classgraph which were automatically generated by the agent. I may also note that classgraph was not effectively reachable in the project, there was an |
How did you fix it? Never heard of this classgraph thing, is there any way to see if my project uses this aswell and therefore fails? |
@Scui1 However, I think the error that is thrown is quite misleading. From what I debugged, it seems like that on the first startup the jvm tries to load the main method in com.oracle.svm.hosted.NativeImageGeneratorRunner. Line 92 in 03cba2a
But "java.lang.Class.getDeclaredMethods0" on the NativeImageGeneratorRunner class tries to load (for whatever reason) "com.oracle.graal.pointsto.util.AnalysisError$ParsingError", which results in loading the pointsto jar.
|
I'm seeing a similar message with GraalVM 22.3.1 Java 17 CE (Java Version 17.0.6+10-jvmci-22.3-b13)
I'm not sure where to go from here. |
Start with an empty project and then gradually adding dependencies and code. |
Facing similar issue. Any workaround for this? Error: Unsupported features in 4 methods
Detailed message:
Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.util.jar.JarFile. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by
reading field jdk.internal.module.ModuleReferences$JarModuleReader.jf of constant
jdk.internal.module.ModuleReferences$JarModuleReader@9e8d7cf: jdk.internal.module.ModuleReferences$JarModuleReader@9e8d7cf
reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant
java.util.concurrent.ConcurrentHashMap$Node@57aad4e7: [module org.graalvm.nativeimage.objectfile, location=file:///home/naresh/apps/gr...
indexing into array java.util.concurrent.ConcurrentHashMap$Node[]@628cdcc7: [Ljava.util.concurrent.ConcurrentHashMap$Node;@628cdcc7
reading field java.util.concurrent.ConcurrentHashMap.table of constant
java.util.concurrent.ConcurrentHashMap@65a8243d: {[module jdk.jstatd, location=jrt:/jdk.jstatd]=jdk.internal.module.SystemModuleF...
reading field jdk.internal.loader.BuiltinClassLoader.moduleToReader of constant
jdk.internal.loader.ClassLoaders$AppClassLoader@71f2a7d5: jdk.internal.loader.ClassLoaders$AppClassLoader@71f2a7d5
reading static field java.lang.ClassLoader.scl |
@nareshkumarthota Can you share a small reproducer to this issue please? |
@oubidar-Abderrahim Thats a licensed product. I have found the solution by doing trial and error. The problem is with metadata genaration with agent lib. In reflect-config.json removed below lines, Then able to build my native-image. {
"name":"jdk.internal.loader.BuiltinClassLoader",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true
},
{
"name":"jdk.internal.loader.ClassLoaders$AppClassLoader",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true
},
{
"name":"jdk.internal.loader.ClassLoaders$PlatformClassLoader",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true
} |
@theotherp does the above solution solve your issue as well? if no can you update your reproducer, I'm no longer able to build it locally. |
Since we cannot faithfully reproduce this issue locally, we'll close this ticket for now. If someone is still facing this issue and can provide a reproducer to it, please reopen the issue, or better, create a new one, and we'll be happy to work on it. Thank you. |
It's plausible. After building, having other problematic messages. In my point of view, it must be some Class unloaded cause the ClassLoaders were excluded. It's quite beyond understanding the procedure of the compilation, should I recognize the problem must be related to some Jar File cause Its stack prints so many times "JarFile", But it doesn't show any File name about the problem jars! I've been troubleshooting this problem for 2 days, I've never seen any helpful stack print, it always prints the classes which is not my own or I don't know what jar is it. After precluding dependence, one by one, finally realized the /~https://github.com/PlaytikaOSS/feign-reactive is the bane. However, I decided to give up on compiling.
|
I hit this error today with the following, I have run agent lib few times with different configuration:
Than I removed from reflect-config.json following entries:
And the error disappeared. But running the binary throw exception:
|
Describe the issue

Building my project using the native-maven-plugin I get the error message
Detected a ZipFile object in the image heap.
. I attached a debugger and found out that theobj
causing the error is the filegraalvm-ce-java17-22.3.0-dev\lib\svm\builder\pointsto.jar
.Not sure which information you need but I took a screenshot of the debugger:
Steps to reproduce the issue
Please include both build steps as well as run steps
core
runmvn package -Pnative -DskipTests -Dmain.port=8080 -Dmain.host=127.0.0.1
Describe GraalVM and your environment:
More details
The text was updated successfully, but these errors were encountered: