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 2022/11/07 16:25:17 UTC

[GitHub] [pulsar-client-cpp] BewareMyPower commented on issue #63: [Bug] create producer and close producer in send callback will dead lock

BewareMyPower commented on issue #63:
URL: https://github.com/apache/pulsar-client-cpp/issues/63#issuecomment-1305862187

   It's an incorrect use to call a synchronous API in the callback of an asynchronous API.
   
   For example, the following Java code also causes the deadlock.
   
   ```java
           @Cleanup final var client = PulsarClient.builder()
                   .serviceUrl(Config.BROKER_URL)
                   .build();
           @Cleanup final var producer = client.newProducer(Schema.STRING)
                   .topic("my-topic")
                   .create();
           producer.sendAsync("hello").thenAccept(msgId -> {
               try {
                   producer.close();
                   System.out.println("Producer closed");
               } catch (PulsarClientException e) {
                   throw new RuntimeException(e);
               }
           }).get();
   ```


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org