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 race with store when fetching messages by a consumer #6003

Merged
merged 4 commits into from
Oct 15, 2024

Conversation

Jarema
Copy link
Member

@Jarema Jarema commented Oct 15, 2024

We were releasing and acquiring again lock while fetching messages to reduce contention. This could cause a consumer getting stuck in certain scenarios, like when max messages per subject was set to 1 and message was republished while consumer was trying to NAK the first one.

  • add a proper test

Signed-off-by: Tomasz Pietrek [email protected]

We were releasing and acquiring again lock while fetching messages to
reduce contention. This could cause a consumer getting stuck in certain
scenarios, like when max messages was set to 1 and messages was
republished while consumer was trying to handle first one.

Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
Signed-off-by: Tomasz Pietrek <[email protected]>
@Jarema Jarema changed the title [DRAFT] Fix race with store when fetching messages by a consumer Fix race with store when fetching messages by a consumer Oct 15, 2024
@Jarema Jarema marked this pull request as ready for review October 15, 2024 10:06
@Jarema Jarema requested a review from a team as a code owner October 15, 2024 10:06
Copy link
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly small things, otherwise looks good.

server/jetstream_consumer_test.go Show resolved Hide resolved
server/jetstream_consumer_test.go Outdated Show resolved Hide resolved
Signed-off-by: Tomasz Pietrek <[email protected]>
Copy link
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekcollison derekcollison merged commit 6c0131f into main Oct 15, 2024
3 of 5 checks passed
@derekcollison derekcollison deleted the remove-unlock-lock-from-consumer branch October 15, 2024 13:57
neilalexander pushed a commit that referenced this pull request Oct 15, 2024
We were releasing and acquiring again lock while fetching messages to
reduce contention. This could cause a consumer getting stuck in certain
scenarios, like when `max messages per subject` was set to `1` and
message was republished while consumer was trying to `NAK` the first
one.

- [ ] add a proper test

Signed-off-by: Tomasz Pietrek <[email protected]>

---------

Signed-off-by: Tomasz Pietrek <[email protected]>
neilalexander added a commit that referenced this pull request Oct 16, 2024
Includes:

- #5986
- #5995 
- #6000
- #5996
- #6002
- #6003
- #6007

Signed-off-by: Neil Twigg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants