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/05/09 12:03:14 UTC
[GitHub] [pulsar] BewareMyPower commented on a diff in pull request #15508: [fix][c++ client] avoid race condition causing double callback on close
BewareMyPower commented on code in PR #15508:
URL: https://github.com/apache/pulsar/pull/15508#discussion_r867936174
##########
pulsar-client-cpp/lib/ClientImpl.cc:
##########
@@ -536,8 +536,13 @@ void ClientImpl::handleClose(Result result, SharedInt numberOfOpenHandlers, Resu
}
if (*numberOfOpenHandlers == 0) {
Lock lock(mutex_);
- state_ = Closed;
- lock.unlock();
+ if (state_ == Closed) {
+ LOG_DEBUG("Client is already shutting down, possible race condition in handleClose");
+ return lock.unlock();
Review Comment:
```suggestion
return;
```
The `unlock` method could be invoked automatically.
--
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