Windows 11 openjdk-24-ea+34_windows-x64_bin Spring boot: 3.4.2 Apache Tomcat/10.1.34
Gets WARNING at startup:
C:\LocalData\DEV\Java\jdk-24\bin\java.exe --enable-preview --enable-native-access=ALL-UNNAMED -XX:TieredStopAtLevel=1 ...
19:42:21.172 INFO - tools.ToolsApplication : Starting ToolsApplication using Java 24-ea with PID 19000 (...)
...
19:42:22.188 INFO - o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (https)
19:42:22.198 INFO - o.apache.catalina.core.StandardService : Starting service [Tomcat]
19:42:22.198 INFO - o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.34]
...
19:42:23.171 INFO - o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (https) with context path '/'
19:42:23.177 INFO - tools.ToolsApplication : Started ToolsApplication in 2.428 seconds (process running for 2.821)
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::invokeCleaner has been called by org.apache.tomcat.util.buf.ByteBufferUtils (file:/E:/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.34/f610f84be607fbc82e393cc220f0ad45f92afc91/tomcat-embed-core-10.1.34.jar)
WARNING: Please consider reporting this to the maintainers of class org.apache.tomcat.util.buf.ByteBufferUtils
WARNING: sun.misc.Unsafe::invokeCleaner will be removed in a future release
Havent' seen this reported anywhere else (searching here did not find anything).
I raised this in Apache Bugzilla as well: https://bz.apache.org/bugzilla/show_bug.cgi?id=69559
They didn't seem too interested...
Comment From: philwebb
We also have #44033 tracking a similar issue.
Running our SampleTomcatApplication
, I don't see any calls to Unsafe.invokeCleaner
when debugging the application. @transentia, is there anything unusual about your application configuration? Can you provide a sample that reproduces the warning?
Comment From: wilkinsona
I think the use of SSL might be key here. Using the JVM argument --sun-misc-unsafe-memory-access=debug
to get a stack trace when invokeCleaner
is called, the following is logged when a request that uses HTTPS is received:
WARNING: sun.misc.Unsafe::invokeCleaner called by org.apache.tomcat.util.buf.ByteBufferUtils (file:/Users/aw036093/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.34/f610f84be607fbc82e393cc220f0ad45f92afc91/tomcat-embed-core-10.1.34.jar)
at org.apache.tomcat.util.buf.ByteBufferUtils.<clinit>(ByteBufferUtils.java:46)
at org.apache.tomcat.util.net.SocketBufferHandler.expand(SocketBufferHandler.java:222)
at org.apache.tomcat.util.net.SecureNioChannel.processSNI(SecureNioChannel.java:319)
at org.apache.tomcat.util.net.SecureNioChannel.handshake(SecureNioChannel.java:154)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1716)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
at java.base/java.lang.Thread.run(Thread.java:1447)
As far as I can tell, there's no configuration option that would allow us to use SSL but not go down this code path. What have I missed please, @markt-asf?
Comment From: wilkinsona
There's a similar problem when using HTTP/2:
WARNING: sun.misc.Unsafe::invokeCleaner called by org.apache.tomcat.util.buf.ByteBufferUtils (file:/Users/aw036093/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.34/f610f84be607fbc82e393cc220f0ad45f92afc91/tomcat-embed-core-10.1.34.jar)
at org.apache.tomcat.util.buf.ByteBufferUtils.<clinit>(ByteBufferUtils.java:46)
at org.apache.tomcat.util.net.SocketBufferHandler.expand(SocketBufferHandler.java:222)
at org.apache.coyote.http2.Http2AsyncParser.<init>(Http2AsyncParser.java:44)
at org.apache.coyote.http2.Http2AsyncUpgradeHandler.getParser(Http2AsyncUpgradeHandler.java:86)
at org.apache.coyote.http2.Http2UpgradeHandler.init(Http2UpgradeHandler.java:206)
at org.apache.coyote.http2.Http2AsyncUpgradeHandler.init(Http2AsyncUpgradeHandler.java:43)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:947)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
at java.base/java.lang.Thread.run(Thread.java:1447)
This was without SSL. With SSL, the earlier warning prevents the later warning as I believe use of invokeCleaner
is only logged once.
Comment From: markt-asf
I think we (Tomcat) need to decouple ByteBufferUtils.expand()
and ByteBufferUtils.cleanDirectBuffer()
. I'll see what I can do.
Comment From: markt-asf
Should be fixed for the February releases.
Comment From: wilkinsona
Thanks very much, Mark. Closing in favor of https://bz.apache.org/bugzilla/show_bug.cgi?id=69559.