ConsumerBuilderImpl#subscribe stuck when using pulsar-client:3.0.x with jackson-annotations prior to 2.12.0 #21971
Closed
2 tasks done
Labels
type/bug
The PR fixed a bug or issue reported a bug
Search before asking
Motivation
In summary,
jackson-annotations:2.12.0
or later is now required forpulsar-client 3.0.x
, and this also applies to versions 3.1.x and 3.2.x.My colleague experienced an issue where the caller thread was blocked at the
ConsumerBuilder#subscribe
method. Below is the stack trace:The worst part is the absence of any error message; the main thread simply gets blocked indefinitely. After investigating, I identified the root cause mentioned above.
A full example to reproduce this issue can be found here: https://github.com/Shawyeok/pulsarClientSubscribeStuck
Below is the missing stack trace for
ClassNotFoundException
Stacktrace
Solution
The
ClassNotFoundException
is thrown from thedoSubscribeTopicPartitions
method call, which is nested inside awhenComplete
block. As a result,subscribeResult
never completes. The relevant code can be found here:pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java
Lines 1000 to 1009 in 434da8b
To address this issue, we could modify the
whenComplete
to a combination ofthenAccept
andexceptionally
. Here's how it could be rewritten:"Alternatives
No response
Anything else?
Here are related discussions:
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: