From f4dfdf96b0531961d6d44f3cb9301e51f380bdcb Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Sun, 16 Aug 2020 13:02:41 +0200 Subject: [PATCH] Explicit initialization config could be quite interesting for https://github.com/Yolean/kubernetes-kafka/pull/310 because when I investigated the timeouts there I found reports that similar errors had been fixed by cleaning up (or trashing) persisted state. > Detected a direct/mapped ByteBuffer in the image heap. > A direct ByteBuffer has a pointer to unmanaged C memory, > and C memory from the image generator is not available at image run time. > A mapped ByteBuffer references a file descriptor, > which is no longer open and mapped at run time. Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a direct/mapped ByteBuffer in the image heap. A direct ByteBuffer has a pointer to unmanaged C memory, and C memory from the image generator is not available at image run time.A mapped ByteBuffer references a file descriptor, which is no longer open and mapped at run time. To see how this object got instantiated use -H:+TraceClassInitialization. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image run time by using the option --initialize-at-run-time=. Or you can write your own initialization methods and call them explicitly from your main entry point. Detailed message: Trace: at parsing org.apache.zookeeper.server.persistence.FilePadding.padFile(FilePadding.java:78) Call path from entry point to org.apache.zookeeper.server.persistence.FilePadding.padFile(FileChannel): at org.apache.zookeeper.server.persistence.FilePadding.padFile(FilePadding.java:76) --- native/zookeeper-server-start.Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/native/zookeeper-server-start.Dockerfile b/native/zookeeper-server-start.Dockerfile index e33353a..a5e2755 100644 --- a/native/zookeeper-server-start.Dockerfile +++ b/native/zookeeper-server-start.Dockerfile @@ -34,6 +34,10 @@ RUN native-image \ -H:+ReportExceptionStackTraces \ --no-fallback \ -H:ConfigurationFileDirectories=/home/nonroot/native-config \ + --initialize-at-build-time \ + --initialize-at-run-time=org.apache.zookeeper.server.persistence.FileTxnLog \ + --initialize-at-run-time=org.apache.zookeeper.server.persistence.TxnLogToolkit \ + --initialize-at-run-time=org.apache.zookeeper.server.persistence.FilePadding \ # Added because of org.apache.zookeeper.common.X509Util, org.apache.zookeeper.common.ZKConfig, javax.net.ssl.SSLContext ... --allow-incomplete-classpath \ # -D options from entrypoint