summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-12-18 14:20:00 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-12-19 15:10:17 -0500
commitddd4ac7372ea4390b24b7bc3798d6c52351c8241 (patch)
treef194deb89bf08b8fe352b24542a272471c0f662f /src/mongo
parentd9579f3432925f1280e572bcaf80fd454f07a4fb (diff)
downloadmongo-ddd4ac7372ea4390b24b7bc3798d6c52351c8241.tar.gz
SERVER-16179 Remove the periodic lock manager timeout report
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/concurrency/lock_manager.h1
-rw-r--r--src/mongo/db/concurrency/lock_state.cpp74
-rw-r--r--src/mongo/db/concurrency/lock_state.h3
-rw-r--r--src/mongo/db/concurrency/lock_state_test.cpp1
4 files changed, 20 insertions, 59 deletions
diff --git a/src/mongo/db/concurrency/lock_manager.h b/src/mongo/db/concurrency/lock_manager.h
index 141455a046a..8a21b438eea 100644
--- a/src/mongo/db/concurrency/lock_manager.h
+++ b/src/mongo/db/concurrency/lock_manager.h
@@ -40,7 +40,6 @@
#include "mongo/platform/cstdint.h"
#include "mongo/platform/unordered_map.h"
#include "mongo/util/concurrency/mutex.h"
-#include "mongo/util/timer.h"
namespace mongo {
diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp
index 12eed73724e..fd23006ea53 100644
--- a/src/mongo/db/concurrency/lock_state.cpp
+++ b/src/mongo/db/concurrency/lock_state.cpp
@@ -38,6 +38,7 @@
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/stacktrace.h"
+#include "mongo/util/timer.h"
namespace mongo {
namespace {
@@ -55,7 +56,7 @@ namespace {
const ResourceId resourceIdMMAPV1Flush = ResourceId(RESOURCE_MMAPV1_FLUSH, 2ULL);
// How often (in millis) to check for deadlock if a lock has not been granted for some time
- const unsigned DeadlockTimeoutMs = 100;
+ const unsigned DeadlockTimeoutMs = 500;
// Dispenses unique LockerId identifiers
AtomicUInt64 idCounter(0);
@@ -108,48 +109,6 @@ namespace {
}
}
- /**
- * Dumps the contents of the global lock manager to the server log for diagnostics.
- */
- enum {
- LockMgrDumpThrottleMillis = 60000,
- LockMgrDumpThrottleMicros = LockMgrDumpThrottleMillis * 1000
- };
-
- AtomicUInt64 lastDumpTimestampMicros(0);
-
- void dumpGlobalLockManagerAndCallstackThrottled(const Locker* locker) {
- const uint64_t lastDumpMicros = lastDumpTimestampMicros.load();
-
- // Don't print too frequently
- if (curTimeMicros64() - lastDumpMicros < LockMgrDumpThrottleMicros) return;
-
- // Only one thread should dump the lock manager in order to not pollute the log
- if (lastDumpTimestampMicros.compareAndSwap(lastDumpMicros,
- curTimeMicros64()) == lastDumpMicros) {
-
- log() << "LockerId " << locker->getId()
- << " has been waiting to acquire lock for more than 30 seconds. MongoDB will"
- << " print the lock manager state and the stack of the thread that has been"
- << " waiting, for diagnostic purposes. This message does not necessary imply"
- << " that the server is experiencing an outage, but might be an indication of"
- << " an overload.";
-
- // Dump the lock manager state and the stack trace so we can investigate
- globalLockManager.dump();
-
- log() << '\n';
- printStackTrace();
-
- // If a deadlock was discovered, the server will never recover from it, so shutdown
- DeadlockDetector wfg(globalLockManager, locker);
- if (wfg.check().hasCycle()) {
- severe() << "Deadlock found during lock acquisition: " << wfg.toString();
- fassertFailed(28557);
- }
- }
- }
-
} // namespace
@@ -649,14 +608,25 @@ namespace {
if (result == LOCK_OK) break;
- if (checkDeadlock) {
- DeadlockDetector wfg(globalLockManager, this);
- if (wfg.check().hasCycle()) {
- log() << "Deadlock found: " << wfg.toString();
+ DeadlockDetector wfg(globalLockManager, this);
+ if (wfg.check().hasCycle()) {
+ // Make sure that the caller actually expects the deadlock return value
+ if (!checkDeadlock) {
+ severe() << "LockerId " << getId() << " encountered an unexpected deadlock."
+ << " The server will shut down in order to prevent becoming"
+ << " unresponsive. The cycle of deadlocked threads is: "
+ << wfg.toString();
+
+ // Dump the lock manager state and the stack trace so we can investigate
+ globalLockManager.dump();
- result = LOCK_DEADLOCK;
- break;
+ fassertFailed(28589);
}
+
+ warning() << "Deadlock found: " << wfg.toString();
+
+ result = LOCK_DEADLOCK;
+ break;
}
const unsigned elapsedTimeMs = timer.millis();
@@ -666,12 +636,6 @@ namespace {
if (waitTimeMs == 0) {
break;
}
-
- // This will occasionally dump the global lock manager in case lock acquisition is
- // taking too long.
- if (elapsedTimeMs > LockMgrDumpThrottleMillis) {
- dumpGlobalLockManagerAndCallstackThrottled(this);
- }
}
// Cleanup the state, since this is an unused lock now
diff --git a/src/mongo/db/concurrency/lock_state.h b/src/mongo/db/concurrency/lock_state.h
index a017d238736..5e451372858 100644
--- a/src/mongo/db/concurrency/lock_state.h
+++ b/src/mongo/db/concurrency/lock_state.h
@@ -198,9 +198,6 @@ namespace mongo {
int _wuowNestingLevel;
std::queue<ResourceId> _resourcesToUnlockAtEndOfUnitOfWork;
- // For maintaining locking timing statistics
- Timer _timer;
-
//////////////////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/mongo/db/concurrency/lock_state_test.cpp b/src/mongo/db/concurrency/lock_state_test.cpp
index e94410085f1..da26040d83f 100644
--- a/src/mongo/db/concurrency/lock_state_test.cpp
+++ b/src/mongo/db/concurrency/lock_state_test.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/concurrency/lock_manager_test_help.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/log.h"
+#include "mongo/util/timer.h"
namespace mongo {
namespace {