Vanlightly commented on a change in pull request #11570:
URL: https://github.com/apache/pulsar/pull/11570#discussion_r684357363



##########
File path: pulsar-client-cpp/lib/ProducerImpl.cc
##########
@@ -550,10 +559,14 @@ void ProducerImpl::batchMessageTimeoutHandler(const 
boost::system::error_code& e
         return;
     }
     LOG_DEBUG(getName() << " - Batch Message Timer expired");
-    Lock lock(mutex_);
-    auto failures = batchMessageAndSend();
-    lock.unlock();
-    failures.complete();
+
+    // ignore if the producer is already closing/closed
+    if (assertState(Ready)) {
+        Lock lock(mutex_);

Review comment:
       I've fixed that and added some extra state_ checks before 
batchMessageAndSend to avoid race conditions.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to