summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2013-03-01 10:06:18 -0500
committerEric Milkie <milkie@10gen.com>2013-03-01 10:06:25 -0500
commit1f7902206e31305e336c155166a6c12ae0f72ab3 (patch)
tree7409b00d53880c2d50b084114b498e15c0dda36e /src
parentf84a8a92cd95dc925d7285564bbce56efb73ba3b (diff)
downloadmongo-1f7902206e31305e336c155166a6c12ae0f72ab3.tar.gz
SERVER-8734 use a recursive mutex to work around OpenSSL deadlock
Diffstat (limited to 'src')
-rw-r--r--src/mongo/util/net/ssl_manager.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mongo/util/net/ssl_manager.cpp b/src/mongo/util/net/ssl_manager.cpp
index 2f9292ec503..ee1dfce5e90 100644
--- a/src/mongo/util/net/ssl_manager.cpp
+++ b/src/mongo/util/net/ssl_manager.cpp
@@ -19,9 +19,11 @@
#include "mongo/util/net/ssl_manager.h"
-#include <vector>
-#include <string>
+#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/tss.hpp>
+#include <string>
+#include <vector>
+
#include "mongo/bson/util/atomic_int.h"
#include "mongo/util/concurrency/mutex.h"
#include "mongo/util/mongoutils/str.h"
@@ -70,7 +72,7 @@ namespace mongo {
static void init() {
while ( (int)_mutex.size() < CRYPTO_num_locks() )
- _mutex.push_back( new SimpleMutex("SSLThreadInfo") );
+ _mutex.push_back( new boost::recursive_mutex );
}
static SSLThreadInfo* get() {
@@ -86,7 +88,10 @@ namespace mongo {
unsigned _id;
static AtomicUInt _next;
- static std::vector<SimpleMutex*> _mutex;
+ // Note: see SERVER-8734 for why we are using a recursive mutex here.
+ // Once the deadlock fix in OpenSSL is incorporated into most distros of
+ // Linux, this can be changed back to a nonrecursive mutex.
+ static std::vector<boost::recursive_mutex*> _mutex;
static boost::thread_specific_ptr<SSLThreadInfo> _thread;
};
@@ -98,7 +103,7 @@ namespace mongo {
}
AtomicUInt SSLThreadInfo::_next;
- std::vector<SimpleMutex*> SSLThreadInfo::_mutex;
+ std::vector<boost::recursive_mutex*> SSLThreadInfo::_mutex;
boost::thread_specific_ptr<SSLThreadInfo> SSLThreadInfo::_thread;
////////////////////////////////////////////////////////////////