diff options
author | Benety Goh <benety@mongodb.com> | 2018-01-22 07:30:14 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2018-01-25 14:50:22 -0500 |
commit | a046f953101dc64af42da2c72e79a11098f76a7e (patch) | |
tree | fcac2a7278420e40b1cf4468f539b30c79ad3af0 /src/mongo/client/remote_command_retry_scheduler.cpp | |
parent | bcdb10268a736670e5e51aa01e99dac5fb09922f (diff) | |
download | mongo-a046f953101dc64af42da2c72e79a11098f76a7e.tar.gz |
SERVER-32783 RemoteCommandRetryScheduler releases callback resources on completion
Diffstat (limited to 'src/mongo/client/remote_command_retry_scheduler.cpp')
-rw-r--r-- | src/mongo/client/remote_command_retry_scheduler.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/client/remote_command_retry_scheduler.cpp b/src/mongo/client/remote_command_retry_scheduler.cpp index 026f0838718..77735816d10 100644 --- a/src/mongo/client/remote_command_retry_scheduler.cpp +++ b/src/mongo/client/remote_command_retry_scheduler.cpp @@ -284,8 +284,15 @@ void RemoteCommandRetryScheduler::_remoteCommandCallback( void RemoteCommandRetryScheduler::_onComplete( const executor::TaskExecutor::RemoteCommandCallbackArgs& rcba) { + + invariant(_callback); _callback(rcba); + // This will release the resources held by the '_callback' function object. To avoid any issues + // with destruction logic in the function object's resources accessing this + // RemoteCommandRetryScheduler, we release this function object outside the lock. + _callback = {}; + stdx::lock_guard<stdx::mutex> lock(_mutex); invariant(_isActive_inlock()); _state = State::kComplete; |