android content provider robustness on provider crash
- by user1298992
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 ?