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

Only wait for the lock when there was actually batches enqueued #670

Merged
merged 2 commits into from
Mar 20, 2020

Conversation

ankon
Copy link
Contributor

@ankon ankon commented Mar 19, 2020

It is possible for fetch to have requests with no batches: If a seek happens
between fetch processing the known seek offsets and the actual request checking
the partitions and skipping any that have a seek offset at that point the protection
against empty requests isn't enough.

In this case we must not wait for the lock here, because there won't be any task
that can unlock it, and in result we end up with never fetching again for this specific
group.

This fixes the issue seen with https://kafkajs.slack.com/archives/CF6RFPF6K/p1584530032102400

It is possible for fetch to have requests with no batches: If a seek happens
between `fetch` processing the known seek offsets and the actual request checking
the partitions and skipping any that have a seek offset _at that point_ the protection
against empty requests isn't enough.

In this case we must not wait for the lock here, because there won't be any task
that can unlock it, and in result we end up with never fetching again for this specific
group.

This fixes the issue seen with https://kafkajs.slack.com/archives/CF6RFPF6K/p1584530032102400
@JaapRood
Copy link
Collaborator

Nice find, thanks for investigating that so thoroughly!

@JaapRood JaapRood requested a review from tulios March 19, 2020 11:24
@Nevon Nevon self-requested a review March 19, 2020 13:49
@Nevon
Copy link
Collaborator

Nevon commented Mar 19, 2020

That cannot have been an easy thing to find. Nice!

@tulios
Copy link
Owner

tulios commented Mar 20, 2020

@ankon can you merge master here so we can merge?

@ankon
Copy link
Contributor Author

ankon commented Mar 20, 2020

Sure :)

@tulios tulios merged commit 2def295 into tulios:master Mar 20, 2020
@tulios
Copy link
Owner

tulios commented Mar 20, 2020

🎉

@ankon ankon deleted the pr/fetch-handle-empty-batches branch March 20, 2020 13:04
@ankon ankon mentioned this pull request May 29, 2020
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.

None yet

4 participants