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

Possible race condition when resetting a subscription to head #2261

Closed
matt2e opened this issue Aug 5, 2024 · 1 comment · Fixed by #2301
Closed

Possible race condition when resetting a subscription to head #2261

matt2e opened this issue Aug 5, 2024 · 1 comment · Fixed by #2301
Assignees

Comments

@matt2e
Copy link
Collaborator

matt2e commented Aug 5, 2024

Was noticed during PR review, but not sure how important it is:
#2210

Possible case:

  • Subscription is behind and currently consuming an event
  • Reset subscription command comes in sets the state to idle and updates the cursor to head
  • 2 new events are posted to the topic
  • New event starts being consumed by the subscription
  • Original event (from before the reset command) finishes being processed, sets the state to idle even though we are processing the other event still
  • Then pub sub triggers the next event to be processed (without knowing the other event is being processed still)
@github-actions github-actions bot added the triage Issue needs triaging label Aug 5, 2024
@ftl-robot ftl-robot mentioned this issue Aug 5, 2024
@matt2e
Copy link
Collaborator Author

matt2e commented Aug 5, 2024

From original comment by @worstell:

ah interesting, do you think the solution would be to only update the cursor and not the state? so that if there are any outstanding async calls executing, they'd have to complete before any new ones are kicked off

Honestly I'm not sure. Maybe that would be the neatest solution?

@worstell worstell self-assigned this Aug 5, 2024
@github-actions github-actions bot removed the triage Issue needs triaging label Aug 5, 2024
worstell added a commit that referenced this issue Aug 8, 2024
only update cursor, leave state as-is

fixes #2261
github-merge-queue bot pushed a commit that referenced this issue Aug 12, 2024
only update cursor, leave state as-is

fixes #2261
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 a pull request may close this issue.

2 participants