Skip to content

Nullpointer in DelegatingInvocableHandler, lookup in "handlerReturnsMessage" map fails. #1952

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

Closed
garyrussell opened this issue Sep 23, 2021 Discussed in #1947 · 0 comments · Fixed by #1953
Closed

Nullpointer in DelegatingInvocableHandler, lookup in "handlerReturnsMessage" map fails. #1952

garyrussell opened this issue Sep 23, 2021 Discussed in #1947 · 0 comments · Fixed by #1953

Comments

@garyrussell
Copy link
Contributor

Discussed in #1947

Originally posted by hannybNdq September 20, 2021
Affects Version(s): \2.7.1

Nullpointer in DelegatingInvocableHandler, lookup in "handlerReturnsMessage" map fails.

Two handlers (annotated with @KafkaHandler) within the same class (annotated with @KafkaListener) listening for different payload types:

@KafkaHandler
private void onA(final A descriptor) {
...
}
@KafkaHandler
private void onB(final B descriptor) {
...
}

After running successfully for weeks at a time we sometimes get a Nullpointer in the DelegatingInvocableHandler at return new InvocationResult(result, replyTo, (Boolean)this.handlerReturnsMessage.get(handler)) when looking up one of the handlers.
For example when looking up the onA handler the "handlerReturnsMessage" map contains the onB handler and null so the lookup of onA returns null.
We have seen the lookup fail for both the onA and onB handlers, never both at once.
When this fails it usually only happens for one or two Kubernetes pods out of the bunch.
After restarting the failing pod the handlers can both consume again.

Spring Kafka version: 2.7.1
KAFKA_CONCURRENCY: 12
The number of topic partitions is higher than the number of running pods * concurrency.

Any ideas on why this happens?

@garyrussell garyrussell self-assigned this Sep 23, 2021
@garyrussell garyrussell added this to the 2.8.0-RC1 milestone Sep 23, 2021
garyrussell added a commit to garyrussell/spring-kafka that referenced this issue Sep 23, 2021
Resolves spring-projects#1952

Since maps are built on the fly, maps need to support concurrency.
garyrussell added a commit to garyrussell/spring-kafka that referenced this issue Sep 23, 2021
Resolves spring-projects#1952

Since maps are built on the fly, maps need to support concurrency.

**cherry-pick back to 2.5.x**
artembilan pushed a commit that referenced this issue Sep 23, 2021
Resolves #1952

Since maps are built on the fly, maps need to support concurrency.

**cherry-pick back to 2.5.x**
artembilan pushed a commit that referenced this issue Sep 23, 2021
Resolves #1952

Since maps are built on the fly, maps need to support concurrency.

**cherry-pick back to 2.5.x**
artembilan pushed a commit that referenced this issue Sep 23, 2021
Resolves #1952

Since maps are built on the fly, maps need to support concurrency.

**cherry-pick back to 2.5.x**
artembilan pushed a commit that referenced this issue Sep 23, 2021
Resolves #1952

Since maps are built on the fly, maps need to support concurrency.

**cherry-pick back to 2.5.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.

1 participant