Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 8f9c68fa authored by Lee Shombert's avatar Lee Shombert
Browse files

Correct potential deadlock in AnrTimerService

This change eliminates a potential deadlock that would occur if an ANR
timer expires but the upper Java layer has lost track of the timer.
(The mechanism by which the upper layer loses track of the timer is
not understood.)  If the upper layer cannot handle the timer
expiration, the native layer cleans up its records.  That clean-up was
locking a mutex and then calling AnrTimerService::discard, which takes
the mutex again.  Mutexes are non-recursive and this is a deadlock.

The fix removes the extraneous lock.  A dangling comment is also
cleaned up.

Tested with a custom build that triggered the deadlock condition.  The
baseline code generated an ANR report that matches the reports in the
bug.  The modified code did not generate an ANR and proceeded normally.

Flag: EXEMPT bugfix
Bug: 357341347
Test: atest
 * FrameworksServicesTests:AnrTimerTest
 * FrameworksServicesTests:com.android.server.am
 * FrameworksMockingServicesTests:com.android.server.am
Change-Id: I12aeef5905409dc6c062e1fbd23a000cf0c9515c
parent cd0e636d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment