summaryrefslogtreecommitdiffstats
path: root/core/java/android/app
diff options
context:
space:
mode:
authorriddle_hsu <riddle_hsu@htc.com>2014-07-31 00:18:00 +0800
committerriddle_hsu <riddle_hsu@htc.com>2014-07-31 00:18:00 +0800
commit1d6c40a6698d271517e5b333f2d0dd4459913884 (patch)
treef62b383e0e252928fdfb4599cda3efd09eb93c5e /core/java/android/app
parent8224edb94f6421a2d910362c56940dcf991847e6 (diff)
downloadframeworks_base-1d6c40a6698d271517e5b333f2d0dd4459913884.zip
frameworks_base-1d6c40a6698d271517e5b333f2d0dd4459913884.tar.gz
frameworks_base-1d6c40a6698d271517e5b333f2d0dd4459913884.tar.bz2
Prevent system server dump stuck by pipe buffer full.
Symptom: Watchdog timeout during dumping db info. Root Cause: When the caller is system server, this invocation is not IPC that means it is not asynchronous, it will need writer has written all data to finish. But pipe has 16*4KB buffer limit, if no reader consumes the data, it will keep waiting. Solution: Check if caller is system server, then use another thread to write so reader could consume the data in buffer. Change-Id: I4bf80fd645cc9396f51ffc0eb27fb895756c1dcf
Diffstat (limited to 'core/java/android/app')
-rw-r--r--core/java/android/app/ActivityThread.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index c931d79..36fdeb9 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1061,8 +1061,7 @@ public final class ActivityThread {
WindowManagerGlobal.getInstance().dumpGfxInfo(fd);
}
- @Override
- public void dumpDbInfo(FileDescriptor fd, String[] args) {
+ private void dumpDatabaseInfo(FileDescriptor fd, String[] args) {
PrintWriter pw = new FastPrintWriter(new FileOutputStream(fd));
PrintWriterPrinter printer = new PrintWriterPrinter(pw);
SQLiteDebug.dump(printer, args);
@@ -1070,6 +1069,22 @@ public final class ActivityThread {
}
@Override
+ public void dumpDbInfo(final FileDescriptor fd, final String[] args) {
+ if (mSystemThread) {
+ // Ensure this invocation is asynchronous to prevent
+ // writer waiting due to buffer cannot be consumed.
+ AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
+ @Override
+ public void run() {
+ dumpDatabaseInfo(fd, args);
+ }
+ });
+ } else {
+ dumpDatabaseInfo(fd, args);
+ }
+ }
+
+ @Override
public void unstableProviderDied(IBinder provider) {
sendMessage(H.UNSTABLE_PROVIDER_DIED, provider);
}