Skip to content
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: solve Offset Manager and Worker racing condition when stopping #484

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

filipeesch
Copy link
Contributor

@filipeesch filipeesch commented Dec 4, 2023

Description

There was a racing condition between the Offset Manager and the Consumer Worker, which needed to be fixed. The Cancellation token that was passed to the EnqueueAsync worker method was removed, which meant that the worker would accept the message before stopping. Previously, the behaviour was to cancel the last message delivery, but to do this, we needed to try to enqueue the message in the worker and then enqueue the message in the Offset Manager. Calling the method in this order caused a racing condition, as the worker could process the message before it was enqueued in the Offset Manager, triggering an exception and stopping the consumer.

Fixes #482 #488

How Has This Been Tested?

The tests were manually executed and the automated tests were run.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have made corresponding changes to the documentation

Disclaimer

By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our Contributor Ownership Statement

@filipeesch filipeesch merged commit 453996e into master Dec 6, 2023
3 checks passed
@filipeesch filipeesch deleted the fix-offsetmanager-sync branch December 6, 2023 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants