The deadlock detector was armed too early.

This commit is contained in:
JoelKatz
2013-05-24 13:28:18 -07:00
parent 5d7c85c915
commit 204944969e
3 changed files with 6 additions and 3 deletions

View File

@@ -371,6 +371,7 @@ void Application::run()
boost::thread(boost::bind(runIO, boost::ref(mIOService))).detach();
}
theApp->getLoadManager().arm();
mIOService.run(); // This blocks
if (mWSPublicDoor)

View File

@@ -22,7 +22,7 @@ int upTime()
LoadManager::LoadManager(int creditRate, int creditLimit, int debitWarn, int debitLimit) :
mCreditRate(creditRate), mCreditLimit(creditLimit), mDebitWarn(debitWarn), mDebitLimit(debitLimit),
mShutdown(false), mUptime(0), mDeadLock(0), mCosts(LT_MAX)
mShutdown(false), mArmed(false), mUptime(0), mDeadLock(0), mCosts(LT_MAX)
{
addLoadCost(LoadCost(LT_InvalidRequest, -10, LC_CPU | LC_Network));
addLoadCost(LoadCost(LT_RequestNoReply, -1, LC_CPU | LC_Disk));
@@ -353,14 +353,14 @@ void LoadManager::threadEntry()
++mUptime;
int dlTime = mUptime - mDeadLock;
if (dlTime >= 10)
if (mArmed && (dlTime >= 10))
{
if ((dlTime % 10) == 0)
{
boost::thread(BIND_TYPE(&LogDeadLock, dlTime)).detach();
}
assert (dlTime < 180);
assert (dlTime < 500);
}
}

View File

@@ -101,6 +101,7 @@ protected:
int mDebitLimit; // when a source drops below this, we cut it off (should be negative)
bool mShutdown;
bool mArmed;
int mSpace1[4]; // We want mUptime to have its own cache line
int mUptime;
@@ -144,6 +145,7 @@ public:
int getCost(LoadType t) { return mCosts[static_cast<int>(t)].mCost; }
int getUptime();
void noDeadLock();
void arm() { mArmed = true; }
};
class LoadFeeTrack