diff options
author | Keun young Park <keunyoung@google.com> | 2012-03-28 14:13:09 -0700 |
---|---|---|
committer | Keun young Park <keunyoung@google.com> | 2012-03-28 14:13:09 -0700 |
commit | d8973a71a3d1dd670e5dcdf6e94ec0cd45444eec (patch) | |
tree | 5499bb2d33aa98100c1fdb4cef50a715f3d95f66 /MODULE_LICENSE_APACHE2 | |
parent | 559bf2836f5da25b75bfb229fec0d20d540ee426 (diff) | |
download | frameworks_av-d8973a71a3d1dd670e5dcdf6e94ec0cd45444eec.zip frameworks_av-d8973a71a3d1dd670e5dcdf6e94ec0cd45444eec.tar.gz frameworks_av-d8973a71a3d1dd670e5dcdf6e94ec0cd45444eec.tar.bz2 |
Fix deadlock in camera destruction after client app's crash
* why deadlock happened: when an app (CTS camera test) crashes while using
camera, its binder is closed and reference counter is decreased. If camera
is inside callback, sp<Client> inside callback will hold the Client instance,
and Client instance is destroyed when the callback ends as sp<Client> to hold
it no longer exists. The destructor of Client instance tries to clean up
camera H/W which tries to stop threads created by camera HAL including the
thread context where the callback is running. This causes deadlock where the
callback thread itself is waiting for itself to terminate.
Note that the deadlock will not happen if camera callback is not active. In
that case, closing of binder will force the destruction of Client instance,
and the destruction happens in binder thread.
* Fix: Forces Client descruction in binder thread
- remove sp<Client> from callbacks to prevent destruction in callback context
- add client lock to allow callback to use raw pointer safely. This prevents
the destructor from deleting the instance while callback is using it.
- add status change inside destructor with client lock to safely destroy Client
Bug: 6214383
Change-Id: Ic6d6396d4d95ce9e72a16ec2480ae65c100fe806
Diffstat (limited to 'MODULE_LICENSE_APACHE2')
0 files changed, 0 insertions, 0 deletions