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

snssqs: fix consumer starvation #3479

Closed
qustavo opened this issue Jul 8, 2024 · 2 comments · Fixed by #3478
Closed

snssqs: fix consumer starvation #3479

qustavo opened this issue Jul 8, 2024 · 2 comments · Fixed by #3478
Assignees
Labels
kind/bug Something isn't working stale
Milestone

Comments

@qustavo
Copy link
Contributor

qustavo commented Jul 8, 2024

Actual Behavior

The current implementation uses separate goroutines to process each message retrieved by sqsClient.ReceiveMessageWithContext, which is executed when concurrencyMode is set to parallel. The consumeSubscription function waits for all spawned goroutines to complete before receiving the next batch. However, this design has a critical flaw: it starves the consumer if new messages are published during the processing of an existing batch. These newly published messages won't be processed until all goroutines from the original batch have finished their work, effectively blocking the consumption of the new messages.

Expected Behavior

Message handling should not be block until the batch is completely processed.

Steps to Reproduce the Problem

  • Set a handler that blocks for a long time.
  • Publish one sns message.
  • Message will be handled.
  • Publish another message
  • Message will not be handled until the first finishes.
@qustavo qustavo added the kind/bug Something isn't working label Jul 8, 2024
@berndverst berndverst added this to the v1.15 milestone Jul 8, 2024
Copy link

github-actions bot commented Aug 7, 2024

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Aug 7, 2024
Copy link

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants