Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-2035

Netty IndexOutOfBoundsException at io.netty.buffer.AbstractByteBuf.ensureWritable

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • AMQ 7.2.2.GA
    • None
    • None
    • None
    • Hide
      Cause:
      Large messages sent when the broker is configured with zero persistence (by setting persistence-enabled in broker.xml to false) are lost while logging an IndexOutOfBoundsException warning
      Consequence:
      Larges messages cannot be used if the broker has disabled persistence
      Fix:
      Large messages are now encoded correctly by a broker with disabled persistence
      Result:
      Larges messages can be handled by a broker with no persistence
      Show
      Cause: Large messages sent when the broker is configured with zero persistence (by setting persistence-enabled in broker.xml to false) are lost while logging an IndexOutOfBoundsException warning Consequence: Larges messages cannot be used if the broker has disabled persistence Fix: Large messages are now encoded correctly by a broker with disabled persistence Result: Larges messages can be handled by a broker with no persistence
    • Workaround Exists
    • Hide

      Change the minLargeMessageSize where needed (on the locator, the connection factory or as an URL parameter as suggested here https://activemq.apache.org/artemis/docs/1.5.5/large-messages.html) with a value >= 138249 (or the maximum large message size in bytes + 88 bytes) avoiding the message to became a large message (with null storage) and being wrongly encoded.

      Show
      Change the minLargeMessageSize where needed (on the locator, the connection factory or as an URL parameter as suggested here https://activemq.apache.org/artemis/docs/1.5.5/large-messages.html ) with a value >= 138249 (or the maximum large message size in bytes + 88 bytes) avoiding the message to became a large message (with null storage) and being wrongly encoded.
    • Hide

      Occurs under high load with many clients

      Show
      Occurs under high load with many clients

    Description

      The following Stack trace is observed in EAP 7.1.4:

      <Thread-7 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$4@1b3701e)><org.apache.activemq.artemis.core.server> AMQ222038: Starting paging on address 'jms.topic.5620-SAM-topic'; size is currently: 10,485,770 bytes; max-size-bytes: 10,485,760
      <Thread-7 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$4@1b3701e)><org.apache.activemq.artemis.core.server> AMQ222038: Starting paging on address 'jms.topic.5620-SAM-topic'; size is currently: 10,485,770 bytes; max-size-bytes: 10,485,760
      <Thread-1 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$4@1b3701e)><org.apache.activemq.artemis.core.server> Sending unexpected exception to the client: java.lang.IndexOutOfBoundsException: writerIndex(18) + minWritableBytes(138249) exceeds maxCapacity(2855): UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 18, cap: 2855/2855)
      	at io.netty.buffer.AbstractByteBuf.ensureWritable0(AbstractByteBuf.java:275)
      	at io.netty.buffer.AbstractByteBuf.ensureWritable(AbstractByteBuf.java:265)
      	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1068)
      	at io.netty.buffer.WrappedByteBuf.writeBytes(WrappedByteBuf.java:784)
      	at org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.writeBytes(ChannelBufferWrapper.java:588)
      	at org.apache.activemq.artemis.core.message.impl.MessageImpl.encode(MessageImpl.java:507)
      	at org.apache.activemq.artemis.core.paging.impl.PagedMessageImpl.encode(PagedMessageImpl.java:127)
      	at org.apache.activemq.artemis.core.paging.impl.Page.write(Page.java:185)
      	at org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl.page(PagingStoreImpl.java:839)
      	at org.apache.activemq.artemis.core.persistence.impl.nullpm.NullStorageManager.addToPage(NullStorageManager.java:548)
      	at org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.processRoute(PostOfficeImpl.java:977)
      	at org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.route(PostOfficeImpl.java:691)
      	at org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.route(PostOfficeImpl.java:593)
      	at org.apache.activemq.artemis.core.server.impl.ServerSessionImpl.doSend(ServerSessionImpl.java:1592)
      	at org.apache.activemq.artemis.core.server.impl.ServerSessionImpl.sendContinuations(ServerSessionImpl.java:1312)
      	at org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.internalHandlePacket(ServerSessionPacketHandler.java:471)
      	at org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.lambda$handlePacket$0(ServerSessionPacketHandler.java:211)
      	at org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:122)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      : java.lang.IndexOutOfBoundsException: writerIndex(18) + minWritableBytes(138249) exceeds maxCapacity(2855): UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 18, cap: 2855/2855)
      	at io.netty.buffer.AbstractByteBuf.ensureWritable0(AbstractByteBuf.java:275)
      	at io.netty.buffer.AbstractByteBuf.ensureWritable(AbstractByteBuf.java:265)
      	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1068)
      	at io.netty.buffer.WrappedByteBuf.writeBytes(WrappedByteBuf.java:784)
      	at org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.writeBytes(ChannelBufferWrapper.java:588)
      	at org.apache.activemq.artemis.core.message.impl.MessageImpl.encode(MessageImpl.java:507)
      	at org.apache.activemq.artemis.core.paging.impl.PagedMessageImpl.encode(PagedMessageImpl.java:127)
      	at org.apache.activemq.artemis.core.paging.impl.Page.write(Page.java:185)
      	at org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl.page(PagingStoreImpl.java:839)
      	at org.apache.activemq.artemis.core.persistence.impl.nullpm.NullStorageManager.addToPage(NullStorageManager.java:548)
      	at org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.processRoute(PostOfficeImpl.java:977)
      	at org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.route(PostOfficeImpl.java:691)
      	at org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.route(PostOfficeImpl.java:593)
      	at org.apache.activemq.artemis.core.server.impl.ServerSessionImpl.doSend(ServerSessionImpl.java:1592)
      	at org.apache.activemq.artemis.core.server.impl.ServerSessionImpl.sendContinuations(ServerSessionImpl.java:1312)
      	at org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.internalHandlePacket(ServerSessionPacketHandler.java:471)
      	at org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.lambda$handlePacket$0(ServerSessionPacketHandler.java:211)
      	at org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:122)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_181]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_181]
      	at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_181]
      

      Attachments

        Issue Links

          Activity

            People

              fnigro Francesco Nigro
              rhn-support-shiggs Stephen Higgs
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: