Qpid
  1. Qpid
  2. QPID-4274

second invocation of createConsumer fails for queue in JNDI properties

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 0.14, 0.18
    • Fix Version/s: 0.21
    • Component/s: Java Client
    • Labels:

      Description

      Description of problem:
      Creating in a loop a connection, session and consumer defined in JNDI property file, 2nd instance of the loop raises "Queue not found" exception.

      Version-Release number of selected component (if applicable):
      qpid-java-*-0.14-3

      How reproducible:
      100%

      Steps to Reproduce:
      See reproducer.

      Actual results:
      (stack trace from Java client 0.14)
      ERROR [IoReceiver - localhost/127.0.0.1:5672] (AMQConnection.java:1267) - Throwable Received but no listener set: org.apache.qpid.AMQException: ch=0 id=0 ExecutionException(errorCode=NOT_FOUND, commandId=0, classCode=4, commandCode=7, fieldIndex=0, description=not-found: Queue not found: response-queue (qpid/broker/SessionAdapter.cpp:686), errorInfo={}) [error code 404: not found]
      ERROR [main] (AMQConnection.java:1267) - Throwable Received but no listener set: org.apache.qpid.AMQException: ch=0 id=0 ExecutionException(errorCode=NOT_FOUND, commandId=0, classCode=4, commandCode=7, fieldIndex=0, description=not-found: Queue not found: response-queue (qpid/broker/SessionAdapter.cpp:686), errorInfo={}) [error code 404: not found]
      javax.jms.JMSException: Error registering consumer: org.apache.qpid.AMQException: ch=0 id=0 ExecutionException(errorCode=NOT_FOUND, commandId=0, classCode=4, commandCode=7, fieldIndex=0, description=not-found: Queue not found: response-queue (qpid/broker/SessionAdapter.cpp:686), errorInfo={}) [error code 404: not found]
      at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2105)
      at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2040)
      at org.apache.qpid.client.AMQConnectionDelegate_0_10.executeRetrySupport(AMQConnectionDelegate_0_10.java:369)
      at org.apache.qpid.client.AMQConnection.executeRetrySupport(AMQConnection.java:586)
      at org.apache.qpid.client.failover.FailoverRetrySupport.execute(FailoverRetrySupport.java:102)
      at org.apache.qpid.client.AMQSession.createConsumerImpl(AMQSession.java:2038)
      at org.apache.qpid.client.AMQSession.createConsumer(AMQSession.java:996)
      at Test_00689136.<init>(Test_00689136.java:71)
      at Test_00689136.main(Test_00689136.java:46)
      Caused by: org.apache.qpid.AMQException: ch=0 id=0 ExecutionException(errorCode=NOT_FOUND, commandId=0, classCode=4, commandCode=7, fieldIndex=0, description=not-found: Queue not found: response-queue (qpid/broker/SessionAdapter.cpp:686), errorInfo={}) [error code 404: not found]
      at org.apache.qpid.client.AMQSession_0_10.setCurrentException(AMQSession_0_10.java:1102)
      at org.apache.qpid.client.AMQSession_0_10.sync(AMQSession_0_10.java:1082)
      at org.apache.qpid.client.AMQSession_0_10.sendConsume(AMQSession_0_10.java:686)
      at org.apache.qpid.client.AMQSession_0_10.sendConsume(AMQSession_0_10.java:87)
      at org.apache.qpid.client.AMQSession.consumeFromQueue(AMQSession.java:2626)
      at org.apache.qpid.client.AMQSession.registerConsumer(AMQSession.java:2962)
      at org.apache.qpid.client.AMQSession.access$500(AMQSession.java:120)
      at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2082)
      ... 8 more

      Expected results:
      No exception raised.

      Additional info:
      trivial patch to be uploaded

        Activity

        Hide
        Pavel Moravec added a comment -

        Reproducer

        Show
        Pavel Moravec added a comment - Reproducer
        Hide
        Pavel Moravec added a comment -

        Simple patch proposal.

        calling

        Context ctx = new InitialContext(properties);

        just once causes Destination object to be created just once. First invocation of:

        MessageConsumer clientConsumer = session.createConsumer(destination/queue)

        then sets address resolution to current timestamp to prevent resolving the address later on (see handleAddressBasedDestination in AMQSession_0_10 class for details).

        Next invocation of createConsumer sees the destination has address already resolved, what is wrong.

        To correct it, once the queue is deleted (when closing the consumer), address resolution of the destination has to be re-set to 0.

        Show
        Pavel Moravec added a comment - Simple patch proposal. calling Context ctx = new InitialContext(properties); just once causes Destination object to be created just once. First invocation of: MessageConsumer clientConsumer = session.createConsumer(destination/queue) then sets address resolution to current timestamp to prevent resolving the address later on (see handleAddressBasedDestination in AMQSession_0_10 class for details). Next invocation of createConsumer sees the destination has address already resolved, what is wrong. To correct it, once the queue is deleted (when closing the consumer), address resolution of the destination has to be re-set to 0.
        Hide
        Rajith Attapattu added a comment -

        Applied Pavel's patch but in a different location (where node deletion is handled) as the Queue can be deleted by Producer not just a Consumer and will cause the same issue.
        http://svn.apache.org/r1454134

        Also applied the same fix for exchanges as a deletion triggered by a consumer/producer close can cause the same issue if the same destination is re-used to create another producer or consumer.
        http://svn.apache.org/r1454135

        Show
        Rajith Attapattu added a comment - Applied Pavel's patch but in a different location (where node deletion is handled) as the Queue can be deleted by Producer not just a Consumer and will cause the same issue. http://svn.apache.org/r1454134 Also applied the same fix for exchanges as a deletion triggered by a consumer/producer close can cause the same issue if the same destination is re-used to create another producer or consumer. http://svn.apache.org/r1454135

          People

          • Assignee:
            Rajith Attapattu
            Reporter:
            Pavel Moravec
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 2h
              2h
              Remaining:
              Remaining Estimate - 2h
              2h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development