Affects Version/s: 0.32.0
Fix Version/s: None
- Azure App Service
- Spring 1.5.12 via embedded web server / standalone
- java.runtime.version "1.8.0_144-b01"
- java.vm.version "25.144-b01"
- java.vm.vendor "Azul Systems, Inc."
- os.arch "amd64"
- os.name "Windows Server 2016"
We are experiencing connection recovery loops after an random (hours to days) amount of time on JMS connection subscribed to a Service Bus Topic via (durable) Subscription. The application does connect to two different service bus instances at the same time.
We had to use the failover:(amqp:...) URL pattern in order to actually see something in the log files as the FailoverProvider is a bit more verbose (TRACE level). When using plain ampqs:// connection URL pattern the only way to tell a hanging/stalled subscription was to monitor the number of active/unconsumed Messages in a Service Bus' Subscription using a different client. Regardless of the Provider implementation, the problem of stalled subscriptions persisted.
Log observations so far:
After an initial disconnect:
the application will enter into a reconnect/connection recovery loop with an interval of one minute.
In between we see the connection being recovered along with log messages as:
after a minute.
A full cycle is attached in the log file, URLs are anonymized.
In general we can see the following sequence of Proton-Events repeating:
We did also open a ticket with Microsoft / Azure as the disconnects seemed to originate from the Service Bus instance (SESSION_REMOTE_CLOSE) where we did learn, that the Service Bus has a hardwired TTL of 5 minutes before inactive Subscriptions will be terminated. According to Azure-Support the issue is most likely related to Qpid connection handling. This does at least explain the first / initial timeout of 300000 seen in the logs. The connection / client is set up as follows
And Spring-JMS Listeners:
In general, Qpid seems to be able to handle refreshing the IdleTimeout using half of the time configured which is configured in the URL.
We could not yet find any explanation why after an random amount of time once of three subscriptions gets into the state illustrated above while other two subscriptions continue working. Please note that in between the reconnect loops, the re-established connection / subscription will not receive any pending messages.
What is implemented differently from the most common scenarios?
- use CLIENT_ACKNOWLEDGE mode
What attempts have been made to work around or reproduce the issue (none worked)?
- We have tried run the client in a docker container and introduce network packet loss (tc) - could not provoke the issue yet.
- switch from DefaultJmsListenerContainerFactory to SimpleJmsContainerFactory
- use a dedicated JmsListenerContainerFactory per subscription, even on the same server
- use failover:(amqps://) instead of amqps://
- recently we did learn, that it makes no difference if the client connects to one or two Service Bus instances, the problem does also show up in 1 JMS Client -> 1 Service Bus Server -> 3 Subscription scenarios. Following that path might be a red herring.
- The amount of time a subscription is in an idle state does't seem to have any effect on the issue. Or at least there seems not to be any difference between idle time of few minutes vs. idle time of days. We will be monitoring that more closely in the future.