3 Replies Latest reply on Jul 22, 2010 1:10 PM by gentilim

    Streaming Consumer Receives Only 1 Message With 0 Client Buffer

    aengineer

      A streaming JMS consumer fails to receive more than 1 message if the client side buffer is set to 0 (via setting '<consumer-window-size>0</consumer-window-size>' in the hornetq-jms.xml file).

       

      For more details on why we set the client side buffer to 0, please refer to http://community.jboss.org/thread/153426.

       

      If you stream N large messages to the JMS server, and then you try to receive these N large messages, you will only get back a single message before the receiver times out. The receiver is essentially

      doing a "consumer.receive(NNN)". The HQ server side log file captures the below stack trace.

       

      To reproduce this issue, you can use the HQ sample app itself (examples/jms/large-message). Simply change the code to send more than 1 message and to receive all published messages. A modified copy of the original source, which will

      publish and attempt to receive 10 messages is attached. If you update 'server0/hornetq-jms.xml' and set the client buffer to 0, you should experience the same behavior.

       

      Stack trace from hornetq.log when attempting to receive N large messages using streaming API.

      [main] 16:27:50,399 INFO [org.hornetq.core.server.impl.HornetQServerImpl]  HornetQ Server version 2.1.0.CR1 (auraria, 118) started

      [Old I/O server worker (parentId: 12073952, channelId: 28880561, null => richmond2.putnaminv.com/172.20.91.67:5142)] 16:29:58,616 SEVERE [org.hornetq.core.protocol.core.ServerSessionPacketHandler]  Caught unexpected exception

      java.lang.NullPointerException

              at org.hornetq.core.server.impl.ServerConsumerImpl.receiveCredits(ServerConsumerImpl.java:470)

              at org.hornetq.core.server.impl.ServerSessionImpl.receiveConsumerCredits(ServerSessionImpl.java:955)

              at org.hornetq.core.protocol.core.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:454)

              at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:471)

              at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:451)

              at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:412)

              at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:459)

              at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:67)

              at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100)

              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)

              at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754)

              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:287)

              at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.decode(HornetQFrameDecoder2.java:169)

              at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.messageReceived(HornetQFrameDecoder2.java:134)

              at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)

              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)

              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)

              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)

              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)

              at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:90)

              at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)

              at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)

              at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:181)

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

              at java.lang.Thread.run(Thread.java:619)

       

      Thanks

      Aspi Engineer

      Putnam Investments

        • 1. Re: Streaming Consumer Receives Only 1 Message With 0 Client Buffer
          ataylor

          ccould you raise a jira and reference this post

          • 2. Re: Streaming Consumer Receives Only 1 Message With 0 Client Buffer
            aengineer
            • 3. Re: Streaming Consumer Receives Only 1 Message With 0 Client Buffer
              gentilim

              I am seeing a similar - but opposite issue.  The client is only able to receive messages when the consumer window size is 0.  However, I get the same exception as mentioned before on the server, but messages are still able to be sent and received.  If the consumer window size is a value other than 0, then the server is able to send without any errors, but the client will only receive a couple messages, if any, before it just stops (without exceptions).  I am using 2.1.1 Final

               

              Excepton seen on server:

              ERROR [ServerSessionPacketHandler] Caught unexpected exception
              java.lang.NullPointerException
              at org.hornetq.core.server.impl.ServerConsumerImpl.receiveCredits(ServerConsumerImpl.java:472)
              at org.hornetq.core.server.impl.ServerSessionImpl.receiveConsumerCredits(ServerSessionImpl.java:950)
              at org.hornetq.core.protocol.core.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:454)
              at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:471)
              at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:451)
              at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:412)
              at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:459)
              at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:67)
              at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100)
              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
              at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754)
              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:287)
              at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.decode(HornetQFrameDecoder2.java:169)
              at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.messageReceived(HornetQFrameDecoder2.java:134)
              at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
              at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754)
              at org.hornetq.core.remoting.impl.netty.HttpAcceptorHandler.messageReceived(HttpAcceptorHandler.java:88)
              at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100)
              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
              at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754)
              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302)
              at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndfireMessageReceived(ReplayingDecoder.java:513)
              at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:497)
              at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:434)
              at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)
              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
              at org.jboss.netty.channel.local.DefaultLocalChannel.flushWriteBuffer(DefaultLocalChannel.java:132)
              at org.jboss.netty.channel.local.LocalClientChannelSink.eventSunk(LocalClientChannelSink.java:88)
              at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:555)
              at org.jboss.netty.channel.Channels.write(Channels.java:611)
              at org.jboss.netty.channel.Channels.write(Channels.java:578)
              at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:258)
              at org.jboss.netty.channel.socket.http.HttpTunnelingServlet.service(HttpTunnelingServlet.java:179)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              at java.lang.Thread.run(Thread.java:619)
              I also noticed this error in the log files after the already mentioned exception:
              java.lang.NullPointerException
              at org.hornetq.core.remoting.impl.netty.HttpAcceptorHandler$ResponseRunner.run(HttpAcceptorHandler.java:173)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
              at java.lang.Thread.run(Thread.java:619)