spring-cloud-aws icon indicating copy to clipboard operation
spring-cloud-aws copied to clipboard

Spring Cloud SQS - SQSListener becoming stale

Open vijayrcse opened this issue 5 years ago • 6 comments

I am using Spring Cloud SQS( spring-cloud-starter-aws-messaging ) in my application

My listener method is annotated as below. But i see that sometimes, the listener is becoming stale or stopped consuming messages from the SQS. I don't see any errors in the logs, and i don't know why this is happening

This is very much a problem as the messages getting queued and we end-up with huge backlog

Please advise how this can be addressed

@SqsListener(value="MessageQueue", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS) public void getMessage(String message) throws MessagingException { super.getMessage(message); }

vijayrcse avatar Jun 08 '20 09:06 vijayrcse

Could you turn on WARN log levels on org.springframework.cloud.aws.messaging.listener and see if there is anything logged?

maciejwalkowiak avatar Jun 08 '20 10:06 maciejwalkowiak

Hi sure, this has happened twice in last 2 months. We have to restart the process to start consuming again. i will enable the logging and see, i couldn't reproduce in lower environment

vijayrcse avatar Jun 08 '20 12:06 vijayrcse

I've seen something similar happening. We never saw anything out of the extraordinary in the logs and never got to investigate this properly as it happened sporadically.

bsamartins avatar Jun 09 '20 21:06 bsamartins

I have enabled WARN but don't see much in the logs. Probably when the issue happens again we may see something. You are right it is happening sporadically.

Any other suggestions or ideas for how to investigate this problem ?

vijayrcse avatar Jun 10 '20 03:06 vijayrcse

At the moment I can only say that we are aware that SQS listener has many issues and it is going to be rewritten in 3.0.

As a workaround you can add health listener (something similar to what's implemented here https://github.com/spring-cloud/spring-cloud-aws/pull/342) and just let whatever controls your services restart the application when listener becomes unhealthy.

maciejwalkowiak avatar Jun 10 '20 08:06 maciejwalkowiak

In my experience, this can happen when the core/max pool size on the ThreadPoolTaskExecutor is too low, especially if you're listening to many queues and only one or two stop working.

dekelpilli avatar Jul 30 '20 01:07 dekelpilli