Bug 1370644 - Part 1: Only use NS_ERROR for an imminent failure. r=froydnj

This modifies the logic in |CheckAcquisition| to only call |NS_ERROR| if we're
really going to deadlock. Instead, if we detect a suspicious cycle, we just use
an |NS_WARNING|. This means that we'll still output warning text in debug
builds, but we won't cause the process to abort.

MozReview-Commit-ID: 71mFInWwbDY
This commit is contained in:
Eric Rahm 2017-06-09 16:09:17 -07:00 коммит произвёл Ehsan Akhgari
Родитель da19e2296f
Коммит 32235488fc
2 изменённых файлов: 12 добавлений и 5 удалений

Просмотреть файл

@ -136,6 +136,8 @@ TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity2DeathTest))
ASSERT_DEATH_IF_SUPPORTED(Sanity2_Child(), regex);
}
#if 0
// Temporarily disabled, see bug 1370644.
int
Sanity3_Child()
{
@ -173,6 +175,7 @@ TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity3DeathTest))
ASSERT_DEATH_IF_SUPPORTED(Sanity3_Child(), regex);
}
#endif
int
Sanity4_Child()
@ -219,6 +222,8 @@ struct ThreadState
int id;
};
#if 0
// Temporarily disabled, see bug 1370644.
static void
TwoThreads_thread(void* arg)
{
@ -277,6 +282,7 @@ TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(TwoThreadsDeathTest))
ASSERT_DEATH_IF_SUPPORTED(TwoThreads_Child(), regex);
}
#endif
static void
ContentionNoDeadlock_thread(void* arg)

Просмотреть файл

@ -301,11 +301,12 @@ BlockingResourceBase::CheckAcquire()
out.AppendLiteral("\nDeadlock may happen for some other execution\n\n");
}
// XXX can customize behavior on whether we /think/ deadlock is
// XXX about to happen. for example:
// XXX if (maybeImminent)
// NS_RUNTIMEABORT(out.get());
NS_ERROR(out.get());
// Only error out if we think a deadlock is imminent.
if (maybeImminent) {
NS_ERROR(out.get());
} else {
NS_WARNING(out.get());
}
}