-
Notifications
You must be signed in to change notification settings - Fork 141
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
Make access to the java consumer fair #1109
Conversation
Fixes #1107 |
Have you verified that this fixes the issue? A unit test would of course be very welcome |
zio-kafka/src/main/scala/zio/kafka/consumer/internal/ConsumerAccess.scala
Outdated
Show resolved
Hide resolved
I confirm it fixes the issue. And it fixes an other issue: #1036 I don't have the
|
I like it! So now the question is, how to unit test this? Perhaps by calling to the consumer from the stream (e.g. get offsets), and then verifying that it makes progress? |
Likely. |
I tried to run the test I wrote with the semaphore version, and the test fail. |
Thanks @flavienbert ! |
@erikvanoosten you're welcome. Do you plan to publish a new version with this fix soon? |
Yes definitely! Probably the coming weekend. |
Zio-concurrent is now a module in the main zio repository. |
@erikvanoosten My bad. I though it was coming from the zio-concurrent repo but comes indeed from ZIO's main repo |
Now that the standard semaphore in zio is fair (since 2.0.20, see zio/zio#8554), we can revert this change, allowing us to remove an external dependency. |
Replace the semaphore that is used to control access to the java consumer with a reentrant lock that has fairness enabled. This prevents liveness problems for consumers that need to use the consumer, e.g. to fetch committed offsets. Fixes #1107.