-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Jetty Version
12.0.27 with HTTP2
Jetty Environment
ee10
Java Version
OpenJDK 17.0.16
Question
I am using WriteListener to return response in application(It only easily returns response in our application, no other function occupies the direct memory), and from the source code, jetty will use outputBuffer to send response. And I am testing the robustness of Jetty with load test, but encounter OutOfMemoryError, you can refer to below. My question is that could you advise if Jetty will recycle the direct memory immediately once the client response the response? When I configure to outputBufferSize to 4096, it is normal.
-
Jetty Configuration
<New id="commonHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration"> <Set name="secureScheme">https</Set> <Set name="sendServerVersion">false</Set> <Set name="outputBufferSize" type="int"> <Property name="jetty.outputBufferSize" default="32768"/> </Set> </New> -
System Configuration or KPI
-
Container Memory : 5G
-
JVM options : -XX:InitialRAMPercentage=56.000000 -XX:MinRAMPercentage=50.000000 -XX:MaxRAMPercentage=56.000000 -XX:MaxDirectMemorySize=1g
-
TPS : 5000
-
Java Stack Trace
-
output stream write errorjava.lang.OutOfMemoryError: Cannot reserve 32768 bytes of direct buffer memory (allocated: 1073741421, limit: 1073741824)\n\tat java.base/java.nio.Bits.reserveMemory(Bits.java:178)\n\tat java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:121)\n\tat java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:332)\n\tat org.eclipse.jetty.util.BufferUtil.allocateDirect(BufferUtil.java:137)\n\tat org.eclipse.jetty.util.BufferUtil.allocate(BufferUtil.java:153)\n\tat org.eclipse.jetty.io.ArrayByteBufferPool.acquire(ArrayByteBufferPool.java:230)\n\tat org.eclipse.jetty.ee10.servlet.HttpOutput.lockedAcquireBuffer(HttpOutput.java:602)\n\tat org.eclipse.jetty.ee10.servlet.HttpOutput.write(HttpOutput.java:781)\n\tat com.test.MyWriteListener.onWritePossible(AsyncWriteListener.java:42)\n\tat org.eclipse.jetty.ee10.servlet.HttpOutput.writeCallback(HttpOutput.java:1383)\n\tat org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.run(ContextHandler.java:1518)\n\tat org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.run(ContextHandler.java:1511)\n\tat org.eclipse.jetty.ee10.servlet.ServletChannel.handle(ServletChannel.java:552)\n\tat org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.run(ContextHandler.java:1524)\n\tat org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.lambda$execute$0(ContextHandler.java:1541)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:981)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1211)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1166)\n\tat java.base/java.lang.Thread.run(Thread.java:840)\n