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

Skip to content
Commit 8e65afd5 authored by Neil Fuller's avatar Neil Fuller
Browse files

Follow best practice for listener notification

When notifying listeners, it's best practice not to hold any locks.
Holding locks during synchronous notifications can cause deadlocks.

One case has been caught where:

A flag affecting the ConfigurationInternal managed by
timezonedector.ServiceConfigAccessorImpl was updated: this caused the
main thread to hold the ServiceConfigAccessorImpl "this" monitor while
notifying the TimeZoneDetectorStrategyImpl (requiring the
TimeZoneDetectorStrategyImpl "this" lock).

Simultaneously, another (binder) thread was calling into
TimeZoneDetectorStrategyImpl to update user configuration, thus holding
the TimeZoneDetectorStrategyImpl "this" lock but attempting to read the
ConfigurationInternal from the ServiceConfigAccessorImpl, and requiring
the ServiceConfigAccessorImpl "this" monitor. Classic deadlock.

This commit modifies (or comments) listener notification code to prevent
deadlocks.

Bug: 259562789
Test: Treehugger
Change-Id: I93b1d9d82ca96062f760c77043e6837398f03cc5
parent 266adbb2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment