android content provider robustness on provider crash

Posted by user1298992 on Stack Overflow See other posts from Stack Overflow or by user1298992
Published on 2012-12-17T21:13:53Z Indexed on 2012/12/17 23:03 UTC
Read the original article Hit count: 371

On android platforms (confirmed on ICS), if a content provider dies while a client is in the middle of a query (i.e. has a open cursor) the framework decides to kill the client processes holding a open cursor.

Here is a logcat output when i tried this with a download manager query that sleeps after doing a query. The "sleep" was to reproduce the problem. you can imagine it happening in a regular use case when the provider dies at the right/wrong time. And then do a kill of com.android.media (which hosts the downloadProvider).

"Killing com.example (pid 12234) because provider com.android.providers.downloads.DownloadProvider is in dying process android.process.media"

I tracked the code for this in ActivityManagerService::removeDyingProviderLocked

Is this a policy decision or is the cursor access unsafe after the provider has died?

It looks like the client cursor is holding a fd for an ashmem location populated by the CP. Is this the reason the clients are killed instead of throwing an exception like Binders when the server (provider) dies ?

© Stack Overflow or respective owner

Related posts about android

Related posts about android-contentprovider