mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-10 16:08:35 +00:00

Thread A: DirectoryHelper#updateContactsDatabase() acquires database lock Thread B: LiveRecipientCache#getSelf() acquires lock on LiveRecipientCache Thread A: DirectoryHelper#updateContactsDatabase() calls Recipient.externalContact(), which eventually needs LiveRecipientCache lock Thread B: Needs to read the database (e.g. line 120) to get information about itself So A has the DB lock but needs the LiveRecipientCache lock, and B has the LiveRecipientCache lock but needs the DB lock. In general, we need to avoid acquiring any new locks in a transaction, but for now, this specific instance looks like it could be solved by using a unique lock for LiveRecipientCache#getSelf().