CompositeByteBuf
with many components. If I convert to ByteBuffer
prior to sending I don't see any problems.07:03:05 [queue-4] DEBUG r.n.channel.ChannelOperationsHandler - [id: 0x09a464e3, L:/127.0.0.1:51978 - R:localhost/127.0.0.1:8443] Writing object DefaultHttpRequest(decodeResult: success, version: HTTP/1.1)
PUT /data HTTP/1.1
user-agent: ReactorNetty/0.8.6.RELEASE
host: localhost:8443
accept: */*
Content-Length: 209715200
07:03:05 [queue-4] DEBUG r.n.channel.ChannelOperationsHandler - [id: 0x09a464e3, L:/127.0.0.1:51978 - R:localhost/127.0.0.1:8443] Writing object
07:03:31 [queue-4] WARN i.n.c.AbstractChannelHandlerContext - An exception 'java.lang.OutOfMemoryError: Direct buffer memory' [enable DEBUG level for full stacktrace] was thrown by a user handler's exceptionCaught() method while handling the following exception:
java.lang.OutOfMemoryError: Direct buffer memory
at java.base/java.nio.Bits.reserveMemory(Bits.java:175)
at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118)
at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317)
at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:768)
at io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:744)
at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:245)
at io.netty.buffer.PoolArena.allocate(PoolArena.java:227)
at io.netty.buffer.PoolArena.allocate(PoolArena.java:147)
at io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:327)
at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:187)
at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:178)
at io.netty.handler.ssl.SslHandler.allocate(SslHandler.java:2120)
at io.netty.handler.ssl.SslHandler.allocateOutNetBuf(SslHandler.java:2131)
at io.netty.handler.ssl.SslHandler.wrap(SslHandler.java:839)
at io.netty.handler.ssl.SslHandler.wrapAndFlush(SslHandler.java:810)
at io.netty.handler.ssl.SslHandler.flush(SslHandler.java:791)
at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:739)
at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:731)
at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:717)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.flush(CombinedChannelDuplexHandler.java:533)
at io.netty.channel.ChannelOutboundHandlerAdapter.flush(ChannelOutboundHandlerAdapter.java:115)
at io.netty.channel.CombinedChannelDuplexHandler.flush(CombinedChannelDuplexHandler.java:358)
at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:739)
at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:731)
at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:717)
at reactor.netty.channel.ChannelOperationsHandler.doWrite(ChannelOperationsHandler.java:306)
private int executeBurst(final PerThreadState state) {
final ExecutorService executor = this.executor;
final int burstLength = this.burstLength;
final Runnable completeTask = state.completeTask;
for (int i = 0; i < burstLength; i++) {
executor.execute(completeTask);
}
final int value = state.spinWaitCompletionOf(burstLength);
state.resetCompleted();
Blackhole.consumeCPU(10);
return value;
}
@Override
public void customize(NettyReactiveWebServerFactory factory) {
// factory.addServerCustomizers(httpServer -> httpServer.wiretap(true));
super.customize(factory);
}