Alessandro Crotti created QPIDJMS-385: -----------------------------------------
Summary: Consumer\Receiver issue with prefetch > 1 Key: QPIDJMS-385 URL: https://issues.apache.org/jira/browse/QPIDJMS-385 Project: Qpid JMS Issue Type: Bug Components: qpid-jms-client Affects Versions: 0.11.1 Environment: I tested this on Windowos Server 2012 R2 and as broker I used Apache QPID Broker 7.0.0 Reporter: Alessandro Crotti Using Qpid JMS 0.11.1 AMQP 1.0 client, which is the latest version for Java 7, I experienced an issue when you set prefetch > 1 and start consuming messages from a queue in asynchronous mode, using "onMessage()" method and sessionMode = Session.CLIENT_ACKNOWLEDGE. Taking prefetch= 10 as example, I noticed that: # When you open connection/session/listener, the client sends a "flow" performative with linkCredit=10, which is correctly the prefetch value. Prefetched messages = 10 # The client starts to process the first message received using class "MessageDeliverTask" method "run()" (all inside JmsMessageConsumer.java) # There is a call "ackFromReceive(envelope)" at row 667 which, following sub-calls, will call method "sendFlowIfNeeded()" of class "AmqpConsumer" # in this method "newCredit" is calculated to send a new "flow" performative. Here the calculation doesn't check how many prefetched messages already are on client side. The currentCredit is 0, for this reason is sent a "flow" performative with linkCredit=10. Prefetched messages =20 # There is a call "messageListener.onMessage(copy);" at row 672 which triggers the import of the message. Then the prefetched messages = 19. # The process starts again from point 2 increasing constantly the prefetched messages collected on client side, causing timeout issues because if they are 1 million of messages, the client can't process them before they expire I compared code of method "sendFlowIfNeeded()" (see point 3) in version 0.11.1 with the code of version 0.31.0: in version 0.31.0 the code is changed and the calculation considers also "prefetchMessageCount". Could this be fixed for Java 7? -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org