diff options
| author | 2024-08-07 09:13:30 -0700 | |
|---|---|---|
| committer | 2024-08-07 10:19:07 -0700 | |
| commit | 8f9c68fa00c959a10401c005b3992ba2eaa6440c (patch) | |
| tree | 8ec3c6f280e437741627340328e292c2af8c81fc /libs/androidfw/StringPool.cpp | |
| parent | cd0e636d7ffcb26700ea2f3d6a3eed75fc3a2f47 (diff) | |
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
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions