-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix race condition in SqsWorker when acknowledgements are enabled #3001
Conversation
Signed-off-by: Krishna Kondaka <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Builds failing. Code LGTM minus 1 minor comment
@@ -226,6 +227,7 @@ && isEventBridgeEventTypeCreated(parsedMessage)) { | |||
for (ParsedMessage parsedMessage : parsedMessagesToRead) { | |||
List<DeleteMessageBatchRequestEntry> waitingForAcknowledgements = new ArrayList<>(); | |||
AcknowledgementSet acknowledgementSet = null; | |||
AtomicBoolean acknowledgementSetReady = new AtomicBoolean(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look like this is used anywhere
Signed-off-by: Krishna Kondaka <[email protected]>
@@ -84,6 +86,8 @@ public boolean isDone() { | |||
if (Instant.now().isAfter(expiryTime)) { | |||
if (callbackFuture != null) { | |||
callbackFuture.cancel(true); | |||
callbackFuture = null; | |||
LOG.warn("AcknowledgementSet expired"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any other data we can provide to make this useful if it happens? I'd imagine there may be a lot of these and they could be hard to understand.
Perhaps include the expiry time? Could we include the overall time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am expecting there shouldn't be a lot of these. Since we only support one source, the acknowledgement set and expiry time should be obvious. We could pass a name to AcknowledgementSetManager.create
when we support multiple sources.
} | ||
try { | ||
Thread.sleep(10000); | ||
} catch (Exception e){} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you expecting the thread to be interrupted? If you are not expecting this, then you can just let an interruption fail the test.
Thread.sleep(10000);
and update the method to throws Exception
.
Signed-off-by: Krishna Kondaka <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.3 2.3
# Navigate to the new working tree
cd .worktrees/backport-2.3
# Create a new branch
git switch --create backport/backport-3001-to-2.3
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 515cf6114f5270f5f4fc94eba6bdd62e45659944
# Push it to GitHub
git push --set-upstream origin backport/backport-3001-to-2.3
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.3 Then, create a pull request where the |
…ensearch-project#3001) * Fix race condition in SqsWorker when acknowledgements are enabled Signed-off-by: Krishna Kondaka <[email protected]> * Modified to do the synchronization in the acknowledgement set framework Signed-off-by: Krishna Kondaka <[email protected]> * Fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Removed unused variable Signed-off-by: Krishna Kondaka <[email protected]> * Addressed review comment and fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Addressed review comments Signed-off-by: Krishna Kondaka <[email protected]> * Fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Fixed checkStyle failure Signed-off-by: Krishna Kondaka <[email protected]> --------- Signed-off-by: Krishna Kondaka <[email protected]> Co-authored-by: Krishna Kondaka <[email protected]> (cherry picked from commit 515cf61)
) (#3010) * Fix race condition in SqsWorker when acknowledgements are enabled Signed-off-by: Krishna Kondaka <[email protected]> * Modified to do the synchronization in the acknowledgement set framework Signed-off-by: Krishna Kondaka <[email protected]> * Fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Removed unused variable Signed-off-by: Krishna Kondaka <[email protected]> * Addressed review comment and fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Addressed review comments Signed-off-by: Krishna Kondaka <[email protected]> * Fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Fixed checkStyle failure Signed-off-by: Krishna Kondaka <[email protected]> --------- Signed-off-by: Krishna Kondaka <[email protected]> Co-authored-by: Krishna Kondaka <[email protected]> (cherry picked from commit 515cf61)
) * Fix race condition in SqsWorker when acknowledgements are enabled Signed-off-by: Krishna Kondaka <[email protected]> * Modified to do the synchronization in the acknowledgement set framework Signed-off-by: Krishna Kondaka <[email protected]> * Fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Removed unused variable Signed-off-by: Krishna Kondaka <[email protected]> * Addressed review comment and fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Addressed review comments Signed-off-by: Krishna Kondaka <[email protected]> * Fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Fixed checkStyle failure Signed-off-by: Krishna Kondaka <[email protected]> --------- Signed-off-by: Krishna Kondaka <[email protected]> Co-authored-by: Krishna Kondaka <[email protected]> Signed-off-by: George Chen <[email protected]>
…ensearch-project#3001) * Fix race condition in SqsWorker when acknowledgements are enabled Signed-off-by: Krishna Kondaka <[email protected]> * Modified to do the synchronization in the acknowledgement set framework Signed-off-by: Krishna Kondaka <[email protected]> * Fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Removed unused variable Signed-off-by: Krishna Kondaka <[email protected]> * Addressed review comment and fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Addressed review comments Signed-off-by: Krishna Kondaka <[email protected]> * Fixed failing tests Signed-off-by: Krishna Kondaka <[email protected]> * Fixed checkStyle failure Signed-off-by: Krishna Kondaka <[email protected]> --------- Signed-off-by: Krishna Kondaka <[email protected]> Co-authored-by: Krishna Kondaka <[email protected]> Signed-off-by: Marcos Gonzalez Mayedo <[email protected]>
Description
Fix race condition in SqsWorker when acknowledgements are enabled
When E2E acknowledgements are enabled, S3 Source need to synchronize between the callback thread and the main thread because main thread may not have got chance to fully populate the waitingForAcknowledgements list
Resolves #3000
Issues Resolved
#3000
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.