Error on building GraalVM Native image. UnsupportedFeatureException with heap limitations

Viewed 537

Does anyone know what implication has this?

[com.springnative.demo.demoapplication:28968]     (clinit):   2,903.05 ms,  6.69 GB
[com.springnative.demo.demoapplication:28968]   (typeflow): 117,219.22 ms,  6.69 GB
[com.springnative.demo.demoapplication:28968]    (objects): 178,872.05 ms,  6.69 GB
[com.springnative.demo.demoapplication:28968]   (features):  19,354.82 ms,  6.69 GB
[com.springnative.demo.demoapplication:28968]     analysis: 328,027.07 ms,  6.69 GB
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.nio.ch.Iocp are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=sun.nio.ch.Iocp.
Detailed message:
Trace:
        at parsing sun.nio.ch.WindowsAsynchronousFileChannelImpl.open(WindowsAsynchronousFileChannelImpl.java:105)
Call path from entry point to sun.nio.ch.WindowsAsynchronousFileChannelImpl.open(FileDescriptor, boolean, boolean, ThreadPool):
        at sun.nio.ch.WindowsAsynchronousFileChannelImpl.open(WindowsAsynchronousFileChannelImpl.java:104)
        at sun.nio.fs.WindowsChannelFactory.newAsynchronousFileChannel(WindowsChannelFactory.java:208)
        at sun.nio.fs.WindowsFileSystemProvider.newAsynchronousFileChannel(WindowsFileSystemProvider.java:140)
        at java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:248)
        at java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:301)
        at org.h2.store.fs.FileAsync.<init>(FilePathAsync.java:121)
        at org.h2.store.fs.FilePathAsync.open(FilePathAsync.java:53)
        at org.h2.store.fs.FilePathSplit.open(FilePathSplit.java:128)
        at org.h2.store.fs.FilePathSplit.newOutputStream(FilePathSplit.java:179)
        at org.h2.store.fs.FileUtils.newOutputStream(FileUtils.java:239)
        at org.h2.server.web.WebServer$TranslateThread.run(WebServer.java:853)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:519)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
        at com.oracle.svm.core.code.IsolateEnterStub.WindowsJavaThreads_osThreadStartRoutine_4bc03aa26f8cdfc97ebd54050e8ae4bce1023851(generated:0)

Yesterday I managed to build the image witouth doing anything with this class issue. Now I've just added an H2 database to the application and tried to run again the GraalVM feature to build the native-image.

Does anyone know if there are memory issues on my side (I own 16GB of RAM) or if it's a bug.

It worked after I retried some build arguments like:

--rerun-class-initialization-at-runtime=sun.nio.ch.Iocp

or

--initialize-at-build-time=sun.nio.ch.Iocp

But the thing is that the image worked after removing any of this. (Strange).

Thanks!

0 Answers
Related