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

Fix KafkaTemplate.clusterId() for concurrency #2943

Closed
artembilan opened this issue Dec 15, 2023 · 0 comments · Fixed by #2944
Closed

Fix KafkaTemplate.clusterId() for concurrency #2943

artembilan opened this issue Dec 15, 2023 · 0 comments · Fixed by #2944

Comments

@artembilan
Copy link
Member

See more info in the discussion: #2780 (comment)

@artembilan artembilan added this to the 3.1.1 milestone Dec 15, 2023
artembilan added a commit to artembilan/spring-kafka that referenced this issue Dec 15, 2023
Fixes: spring-projects#2943

The `if (this.kafkaAdmin != null && this.clusterId == null) {` condition
might be always true for concurrent threads (especially virtual).
Therefore, all of those threads are calling `this.kafkaAdmin.clusterId()`
making unnecessary network chats to Kafka broker

* Surround `this.kafkaAdmin.clusterId()` call with `Lock`

**Cherry-pick to `3.0.x`**
sobychacko pushed a commit that referenced this issue Dec 17, 2023
Fixes: #2943

The `if (this.kafkaAdmin != null && this.clusterId == null) {` condition
might be always true for concurrent threads (especially virtual).
Therefore, all of those threads are calling `this.kafkaAdmin.clusterId()`
making unnecessary network chats to Kafka broker

* Surround `this.kafkaAdmin.clusterId()` call with `Lock`

**Cherry-pick to `3.0.x`**
sobychacko pushed a commit that referenced this issue Dec 17, 2023
Fixes: #2943

The `if (this.kafkaAdmin != null && this.clusterId == null) {` condition
might be always true for concurrent threads (especially virtual).
Therefore, all of those threads are calling `this.kafkaAdmin.clusterId()`
making unnecessary network chats to Kafka broker

* Surround `this.kafkaAdmin.clusterId()` call with `Lock`

**Cherry-pick to `3.0.x`**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants