pulsar
pulsar copied to clipboard
[fix][client] Producer uses pulsar-client-internal thread to execute callback
Fixes #21900
Motivation
In #21900, I guess the user uses a sync call in the pulsar-client-io
callback thread, so throw the timeout exception.
The pulsar-client-io
thread is used to communicate between the broker and the client, when pulsar-client-io
is stuck, the timeout exception will be thrown.
If we switch from the pulsar-client-io
to the pulsar-client-internal
thread to execute the callback, #21900 will be fixed.
In the consumer, there's a similar approach: https://github.com/apache/pulsar/blob/252509e08018eeed189e0d5492c3664a67bced06/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L471-L487
Another approach: Please use the same call(sync or async) in your project.
Modifications
- Producers always use the
pulsar-client-internal
thread to execute the callback.
Verifying this change
ProducerCallbackThreadTest
has been added.
Documentation
- [ ]
doc
- [ ]
doc-required
- [x]
doc-not-needed
- [ ]
doc-complete
Some tests fail when multiple threads are used to execute callbacks.
/pulsarbot rerun-failure-checks