骆驼-netty4:io.netty.util.internal.OutOfDirectMemoryError

camel-netty4: io.netty.util.internal.OutOfDirectMemoryError

提问人:djb 提问时间:11/15/2023 最后编辑:Justin Bertramdjb 更新时间:11/16/2023 访问量:26

问:

我已经浏览了以前所有的时间,有人问过这个问题的某些版本。 以下是答案的概述。

悬而未决:

“只是记忆”:

“将 AUTO_READ 设置为 False”:

就我而言,我在 Apache Karaf 内部,我已经有高达 2GB 的直接内存,我无法进一步提升它。我将骆驼上下文传递给我的豆子以获得骆驼。然后,我只是将XML发送到一个队列,该队列将转到bean。Netty 甚至没有在这项服务中使用,这有点奇怪。因此,它必须位于 ActiveMQ Artemis 的引擎盖下。我不确定当我自己没有配置 Netty 时,我会在哪里将“auto_read”设置为 false,并且 Camel 没有它的设置。producerTemplate

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)

有人能帮我调试这个吗?

Java Apache -Camel netty activemq-artemis netty4

评论

0赞 Justin Bertram 11/16/2023
您使用的是哪个版本的 ActiveMQ Artemis 核心 JMS 客户端?
0赞 djb 11/16/2023
artemis-jms-client 是 artemis-2.16.0.redhat-00046,netty-core 是 4.1.66.Final-redhat-00001
0赞 Justin Bertram 11/16/2023
您是否尝试过使用较新版本的 ActiveMQ Artemis?版本 2.16.0 是将近 3 年前发布的。从那时起,又发布了大约 20 个版本。
0赞 djb 11/16/2023
谢谢,在运行 RH AMQ Broker (7.9) 和 RH Fuse ESB (7.11) 的背景下,我仍然在使用 Java 8,将我们的整个代码库升级到 Java 11 和 JakartaEE 将是一项艰巨的任务。我认为 2.16 是最后一个 Java 8 Artemis?所以,不幸的是,现在可能坚持使用 2.16。如果我开始将整个堆栈从 Karaf 升级到 Spring Boot 或 Quarkus,并使用 Artemis 作为 MQ,您会建议完全升级到 Java 21 吗?
1赞 Justin Bertram 11/17/2023
鉴于您提供的信息,我很难提供可靠的建议。我想我最多能说的是 ActiveMQ Artemis 应该可以与 Java 21 一起工作。

答: 暂无答案