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

Create Consumer and Producer from existing apache kafka Consumer/Producer #1011

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

svroonland
Copy link
Collaborator

@svroonland svroonland commented Aug 6, 2023

Implements #452
Implements #694

Copy link
Collaborator

@erikvanoosten erikvanoosten left a comment

Choose a reason for hiding this comment

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

Nice.

@svroonland svroonland merged commit 643cbdd into master Aug 7, 2023
@svroonland svroonland deleted the from-consumer branch August 7, 2023 07:05
@@ -52,7 +51,13 @@ private[consumer] object ConsumerAccess {
)
}
} { consumer =>
ZIO.blocking(access.withPermit(ZIO.attempt(consumer.close(settings.closeTimeout)))).orDie
ZIO.blocking(ZIO.attempt(consumer.close(settings.closeTimeout))).orDie
Copy link
Member

Choose a reason for hiding this comment

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

Is this change safe? Isn't there a risk that .close is called in parallel with other Consumer methods?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't see how unless it's explicitly leaked from the ZIO scope by the user

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well I was wrong there. See #1238

svroonland added a commit that referenced this pull request Nov 10, 2024
By using a semaphore also for the close operation we guard against
concurrent access during release. This reverts a change made in in
#1011.

The cause of this concurrent access after the Consumer has shutdown is
unfortunately unknown and I haven't been able to reproduce it.

Fixes #1238.
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