Uploaded image for project: 'Qpid JMS'
  1. Qpid JMS
  2. QPIDJMS-433

MessageListener.onMessage() has unhandled exception vulnerability which causes infinite loop

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Information Provided
    • 0.37.0
    • None
    • qpid-jms-client
    • None

    Description

      When using a MessageListener, any uncaught exceptions in onMessage() will create an infinite loop of resending the same message over and over. As the message is never acknowledged during the execution of this loop, stopping the client application and restarting it results in the infinite loop immediately resuming.

      While this is strictly a developer oversight, it is an easy one to make, especially for runtime exceptions. For example, using an illegal character while getting a message property (eg. "msg-type") will result in an IllegalArgumentExceptionexception (rather than in the perhaps expected JMSException), and will trigger this behavior if not explicitly handled in the client.

      The Qpid JMS client implementation should perhaps anticipate this occurrence, and appropriately handle the exception (eg it can then close the connection with an error message).

      Attached is a simple single-class reproducer which illustrates the issue. Sending any message to the queue will result in the triggering of this condition, eg:

      qpid-send -a TestQueue -m1

      and results in:

      Listening on amqp://localhost:5672...
      onMessage(): JmsTextMessage { org.apache.qpid.jms.provider.amqp.message.AmqpJmsTextMessageFacade@a2f68bf }
      UNHANDLED EXCEPTION: java.lang.IllegalArgumentException: Identifier contains invalid JMS identifier character '-': 'msg-type'
      onMessage(): JmsTextMessage { org.apache.qpid.jms.provider.amqp.message.AmqpJmsTextMessageFacade@4dbc00fa }
      UNHANDLED EXCEPTION: java.lang.IllegalArgumentException: Identifier contains invalid JMS identifier character '-': 'msg-type'
      onMessage(): JmsTextMessage { org.apache.qpid.jms.provider.amqp.message.AmqpJmsTextMessageFacade@5e24db1e }
      UNHANDLED EXCEPTION: java.lang.IllegalArgumentException: Identifier contains invalid JMS identifier character '-': 'msg-type'
      ...

      Attachments

        1. pom.xml
          1 kB
          Kim van der Riet
        2. QpidJmsClientTest.java
          2 kB
          Kim van der Riet

        Activity

          People

            Unassigned Unassigned
            kpvdr Kim van der Riet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: