You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/07/17 06:44:11 UTC
[GitHub] [pulsar] fxbing opened a new pull request #4745: Fix:PulsarKafkaProducer is not thread safe
fxbing opened a new pull request #4745: Fix:PulsarKafkaProducer is not thread safe
URL: https://github.com/apache/pulsar/pull/4745
fix #4707
https://github.com/apache/pulsar/blob/v2.3.2/pulsar-client-kafka-compat/pulsar-client-kafka/src/main/java/org/apache/kafka/clients/producer/PulsarKafkaProducer.java#L229
In this line, the update operation of `cluster` is not atomic. The new value of `cluster` is based on th old.
But in multithreading,multiple threads may be dependent on the same old value for updating.
So in https://github.com/apache/pulsar/blob/v2.3.2/pulsar-client-kafka-compat/pulsar-client-kafka/src/main/java/org/apache/kafka/clients/producer/PulsarKafkaProducer.java#L270, thread which is executed at last can run normally, others can't.
And I have added a test for it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services