diff options
| author | 2023-07-24 22:45:44 +0000 | |
|---|---|---|
| committer | 2023-08-01 16:32:49 +0000 | |
| commit | 266f31ae079915ea8e8f357eb644bf39a7d3ecf2 (patch) | |
| tree | 06135082fecfbc60a6eee31e654d3dbebc952cf5 /libs/ultrahdr/jpegencoderhelper.cpp | |
| parent | d430717d81ee3053db7c707a2ab5276e0f5c938f (diff) | |
BQ: Fix deadlock introduced by onFrameDequeued
BufferQueueCore::mMutex should never be locked when calling
consumerListener's callbacks.
The reason is that the consumerListener callback could in turn
acquire BufferQueueCore::mMutex, resulting in deadlock.
The deadlock stack trace for onFrameDequeued is:
- BufferQueueProduer::dequeueBuffer acquires Core::mMutex
- ProxyConsumerListener::onFrameDequeued::onFrameDequeued
promotes a ConsumerListener wp to sp
- The sp becomes the last reference to the ConsumerListener object,
when onFrameDequeued() goes out of scope, ~ConsumerListener is
called
- BufferQueueConsumer::disconnect is called as part of
~ConsumerListener(), and disconnect needs to acquire Core::mMutex
The same issue applies to onFrameCancelled and onFrameDetached.
Test: atest BufferQueueThreading::TestProducerDequeueConsumerDestroy
Bug: 270004534
Change-Id: I22fdc637ccc937594656d6f5bc1ee9b7c506490a
Merged-In: I22fdc637ccc937594656d6f5bc1ee9b7c506490a
Diffstat (limited to 'libs/ultrahdr/jpegencoderhelper.cpp')
0 files changed, 0 insertions, 0 deletions