Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-2571

Sender sometimes, involuntary, autocreates new, consumerless, TempQueue when trying to send to removed TempQueue.

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.1.1
    • 5.4.0
    • Broker
    • None
    • Ubuntu 9.10, P4 2.6 GHz HT, 3 GB RAM.

    Description

      Please see this post for discussion:
      http://old.nabble.com/Problems-with-prefetch-and-TemporaryQueues-td27130529.html

      I've tested this on 4.1.1, and briefly on 5.3.0 with the same result.

      Scenario:
      We have a server and a client. The client posts a message on the servers queue in order to subscribe to updates.
      The server takes the reply address from the client and starts sending messages to a TempQueue created by the client.

      When the client disconnects without notifying the server the following might happen:
      1. The temporary queue is removed correctly when the client exits and closes its connection.

      From here we have three scenarios:
      2.a The server gets an exception the next time it tries to send a message to the TempQueue. This is wanted behaviour. It can then simply drop the "subscription".

      2.b The server isn't notified in time and sends some messages before it gets the exception. Due to AutoCreateDestination being enabled one of these messages creates a new TempQueue with the same name as the one removed. It is of course missing a consumer.
      But since the server gets the exception it will stop posting to the TempQueue. However, when the server closes its connection the TempQueue is not removed and is left lying around with no consumer.

      2.c The server recreates the TempQueue in the same way as in 2.b, but here it never gets the exception for some reason. The server then has no idea that the client left and keeps pilling up messages on the TempQueue until the broker object hits its memory limit and everything connected to the broker halts.

      I think there are three problems here:
      1. The exception is not thrown every time.
      2. When the TempQueue is recreated it is not removed when the server closes its connection. Also, the server gets an InvalidDestinationException if I, at server side, try to connect a consumer to the TempQueue. I guess this means that although the server is the initiator for the auto(re)creation it does not become the owner of the TempQueue. But who is then the owner? The broker itself?

      3. Due to AutoCreateDestination being enabled by default for TempQueues, every post to a TempQueue could result in unknowingly creating a new TempQueue.

      Suggestions
      Setting AutoCreateDestination to false for TempQueues solves all three problems.
      So exposing that option in an easily accessible way is important.

      But even then, 1 and 2 should perhaps be examined separately.

      I'll attach a JUnit test case for this. Unfortunately it is not 100% reliable in detecting the problem. One has to run it multiple times.
      On my test setup it failed correctly 8 times out of 10 runs. You might be able to improve it.

      Best Regards
      Nimos

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            rajdavies Robert Davies
            nimos Simon
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment