azure-sdk-for-java: Error Setup of JMS message listener invoker failed for destination - trying to recover. Cause: The Session is closed

Describe the bug We are using Azure service bus with topics and subscription. The messages in the subscription are processed by our springboot application deployed on Azure Web App. We use spring-cloud-azure-starter-servicebus-jms for sending and receiving messages. We have issue that web app stops listening to Service bus and messages are not processed. In the application insight logs we see “Setup of JMS message listener invoker failed for destination <subscription> - trying to recover. Cause: The Session is closed” and ","Setup of JMS message listener invoker failed for destination ‘<subscription>’ - trying to recover. Cause: Unknown error from remote’ for each of the subscription configured for listening.

Exception or Stack Trace

3/5/2024, 8:03:09.867 PM,"Setup of JMS message listener invoker failed for destination '' - trying to recover. Cause: Unknown error from remote peer",2,trace,"{""LoggerName"":""org.springframework.jms.listener.DefaultMessageListenerContainer"",""SourceType"":""Logger"",""ThreadName"":""org.springframework.jms.JmsListenerEndpointContainer#0-18""}"

2/23/2024, 8:01:00.788 PM,"Setup of JMS message listener invoker failed for destination '' - trying to recover. Cause: The Session is closed",2,trace,"{""LoggerName"":""org.springframework.jms.listener.DefaultMessageListenerContainer"",""SourceType"":""Logger"",""ThreadName"":""org.springframework.jms.JmsListenerEndpointContainer#2-17""}"

To Reproduce Steps to reproduce the behavior: Its occurring randomly. In the past 3 months it has occurred around 4 or 5 times in Production

Code Snippet We have followed Microsoft documentation for configuring our Service bus. Use JMS in Spring to access Azure Service Bus - Java on Azure | Microsoft Learn

For listening we use

@JmsListener(destination = TOPIC_NAME, containerFactory = "topicJmsListenerContainerFactory",
        subscription = SUBSCRIPTION_NAME)
 
For Sending we use 
jmsTemplate.send(
          topic,
          new MessageCreator() {
            @Override
            public Message createMessage(Session session) throws JMSException {
              BytesMessage byteMessage = session.createBytesMessage();
              byteMessage.writeBytes(message.getBytes());
              return setHeaderProperties(byteMessage, type);
            }
          });

application.properties: spring.jms.servicebus.connection-string= spring.jms.servicebus.pricing-tier=Premium spring.jms.servicebus.prefetch-policy.all=5 spring.jms.servicebus.prefetch-policy.durable-topic-prefetch=5 spring.jms.servicebus.prefetch-policy.topic-prefetch=5 spring.servicebus.concurrency=5-40

Expected behavior Messages should be processed continuously without any disruption

Screenshots If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: Azure Web App Linux
  • IDE: Error only on Cloud
  • Library/Libraries: spring-cloud-azure-starter-servicebus-jms, 5.8.0
  • Java version: 17
  • App Server/Environment: Web App
  • Frameworks: Springboot 3.2.3

If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn’t provide solution for the problem, please provide:

  • verbose dependency tree (mvn dependency:tree -Dverbose)
  • exception message, full stack trace, and any available logs

Additional context Add any other context about the problem here.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [x ] Bug Description Added
  • Repro Steps Added
  • Setup information Added

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments

@Netyyyy recently we randomly met this error too, Cloud: Azure China, Region: chinanorth3, SKU: Standard. When can this error be fixed in Azure China too? thank you very much.

Hi @vinaysurya please help take a look, thanks