diff options
author | Debraj Ray <debrajray@Debrajs-MacBook-Air.local> | 2019-02-27 02:49:55 +0530 |
---|---|---|
committer | karthik <kmanivannan@maprtech.com> | 2019-03-08 13:46:57 -0800 |
commit | 79c7ea559ed7adc0074438e6c0eb5aa2340419a6 (patch) | |
tree | 1d38ad39fe562fe75cbf7bd86dee29a1ef892025 | |
parent | 362cded3fbcb99c0c4f951bb97016cb2b0542f94 (diff) |
DRILL-7035: Drill C++ Client crashes on multiple SaslAuthenticatorImpl destruction due to communication error
closes #1660
-rw-r--r-- | contrib/native/client/src/clientlib/drillClientImpl.cpp | 11 | ||||
-rw-r--r-- | contrib/native/client/src/clientlib/drillClientImpl.hpp | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp index bfc17abe1..fe2cb3a8e 100644 --- a/contrib/native/client/src/clientlib/drillClientImpl.cpp +++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp @@ -2311,9 +2311,14 @@ void DrillClientImpl::shutdownSocket(){ // Delete the saslAuthenticatorImpl instance since connection is broken. It will recreated on next // call to connect. - if(m_saslAuthenticator != NULL) { - delete m_saslAuthenticator; - m_saslAuthenticator = NULL; + if (m_saslAuthenticator != NULL) { + { + boost::mutex::scoped_lock lock(m_sasl_dispose_mutex); + if (m_saslAuthenticator != NULL) { + delete m_saslAuthenticator; + m_saslAuthenticator = NULL; + } + } } // Reset the SASL states. diff --git a/contrib/native/client/src/clientlib/drillClientImpl.hpp b/contrib/native/client/src/clientlib/drillClientImpl.hpp index 891874c7d..d6531b224 100644 --- a/contrib/native/client/src/clientlib/drillClientImpl.hpp +++ b/contrib/native/client/src/clientlib/drillClientImpl.hpp @@ -582,6 +582,8 @@ class DrillClientImpl : public DrillClientImplBase{ int m_saslResultCode; bool m_saslDone; boost::mutex m_saslMutex; // mutex to protect m_saslDone + // mutex to protect deallocation of sasl connection + boost::mutex m_sasl_dispose_mutex; boost::condition_variable m_saslCv; // to signal completion of SASL exchange // Used for encryption and is set when server notifies in first handshake response. |