Apache Karaf中Camel调用Artemis触发Netty直接内存溢出求助
Netty直接内存溢出问题排查求助
已查阅的同类问题分类
未解决的同类问题
- 如何定位Netty错误io.netty.util.internal.OutOfDirectMemoryError的根因
- Netty: io.netty.util.internal.OutOfDirectMemoryError
- 启用ResourceLeakDetector仍出现OutOfDirectMemoryError而非Netty内存泄漏错误
"增加内存"方案相关问题
- reactor.netty.ReactorNetty$InternalNettyException: io.netty.util.internal.OutOfDirectMemoryError: failed to allocate 16777216 byte(s) of direct memory
"设置AUTO_READ为False"方案相关问题
- Netty服务器内存持续增长最终因io.netty.util.internal.OutOfDirectMemoryError崩溃
- 为何Netty4代理示例需将channel的AUTO_READ设为false
- Netty ChannelRead方法未被调用
我的场景与问题
我在Apache Karaf环境中运行服务,已配置2GB直接内存且无法进一步扩容。代码中仅通过Camel上下文获取producerTemplate,向队列发送XML消息到Bean,没有显式使用Netty,推测是ActiveMQ Artemis底层调用了Netty。但因为我没有自行配置Netty,Camel也没有相关设置,不知道怎么把AUTO_READ设为false。
代码示例:
producerTemplate.sendBody(queueName, xStream.toXML(corMessage));
服务运行数周后出现以下异常:
io.netty.util.internal.OutOfDirectMemoryError: failed to allocate 14379335 byte(s) of direct memory (used: 1895825408, max: 1908932608) at io.netty.util.internal.PlatformDependent.incrementMemoryCounter(PlatformDependent.java:806) at io.netty.util.internal.PlatformDependent.allocateDirectNoCleaner(PlatformDependent.java:735) at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:649) at io.netty.buffer.PoolArena$DirectArena.newUnpooledChunk(PoolArena.java:638) at io.netty.buffer.PoolArena.allocateHuge(PoolArena.java:214) at io.netty.buffer.PoolArena.allocate(PoolArena.java:141) at io.netty.buffer.PoolArena.allocate(PoolArena.java:126) at io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:396) at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:188) at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:179) at org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnection.createTransportBuffer(NettyConnection.java:253) at org.apache.activemq.artemis.spi.core.protocol.AbstractRemotingConnection.createTransportBuffer(AbstractRemotingConnection.java:189) at org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.createPacket(PacketImpl.java:356) at org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.encode(PacketImpl.java:322) at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:475) at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:434) at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext.sendFullMessage(ActiveMQSessionContext.java:552) at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.sendRegularMessage(ClientProducerImpl.java:296) at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.doSend(ClientProducerImpl.java:268) at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:143) at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:125) at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.doSendx(ActiveMQMessageProducer.java:483) at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:220) at org.apache.activemq.jms.pool.PooledProducer.send(PooledProducer.java:95) at org.apache.activemq.jms.pool.PooledProducer.send(PooledProducer.java:66) at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:634) at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSend(JmsConfiguration.java:647) at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSendToDestination(JmsConfiguration.java:586) at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.access$100(JmsConfiguration.java:528) at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$1.doInJms(JmsConfiguration.java:542) at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:504) at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:539) at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:440) at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:394) at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:157) at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186) at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86) at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:528) at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:493) at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369) at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:493) at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229) at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144) at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161) at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:168)
恳请各位帮忙调试该问题。
内容的提问来源于Stack Exchange,提问作者djb
相关产品推荐
相关产品推荐

