awslabs / awslabs/amazon-sqs-java-messaging-lib

SQSMessageConsumerPrefetch keeps fetching messages after stop

Open
#238 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
183
Forks
150
PR merge metrics
No merged PRs in 30d

Description

1. We have TestA: this test sends the message in the `testAQueue`, and checks some response after it was processed
2. We have TestB: this test invokes http endpoint and waits for the message in the `testAQueue`

When we run TestA, we start JMS Listener for the `testAQueue`. After the test, we stop the listener
When we run TestB, sometimes message in the `testAQueue` does not appear immediately, but appears after `WAIT_TIME_SECONDS`
Both tests should run one after another.

After some debugging, it appears that `SQSMessageConsumerPrefetch` tries to fetch the message even when `running = false`
I've put a non-suspending breakpoint here: https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/master/src/main/java/com/amazon/sqs/javamessaging/SQSMessageConsumerPrefetch.java#L261
to print the state of the `running` flag. When the error I've described is hit, the flag `running` is in `false` state.

Contributor guide

Open the contributing guide

Research direction

Start in src/main/java/com/amazon/sqs/javamessaging/SQSMessageConsumerPrefetch.java at the breakpoint around line 261, then reproduce the sequential TestA/TestB scenario described in the issue. Trace the listener stop and the running flag; done means stopping the listener no longer causes a message fetch, so the following test can receive its message without the delay.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, java
Domain
backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.