-24 即 EMFILE,属于进程内文件描述符耗尽的问题
Solution: ???
需要找出到底是哪些文件没有关闭(查看方式: adb shell, cd /proc/pid/fd , ls -l),以及为什么没关闭.
发现很多/dev/ashmem file handle,然后去/proc/pid/maps去看这些/dev/ashmem的名字,可以发现些蛛丝马迹。
重现办法:在Browser里不断用新增tab的方式来打开新的含有很多图片的网站。
E CursorWindow: Could not allocate CursorWindow '/data/data/com.android.browser/databases/browser2.db' of size 2097152 due to error -24.
E AndroidRuntime: FATAL EXCEPTION: AsyncTask #5
E AndroidRuntime: java.lang.RuntimeException: An error occured while executing doInBackground()
E AndroidRuntime: at android.os.AsyncTask$3.done(AsyncTask.java:299)
E AndroidRuntime: at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
E AndroidRuntime: at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:239)
E AndroidRuntime: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
E AndroidRuntime: at java.lang.Thread.run(Thread.java:838)
E AndroidRuntime: Caused by: android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. # Open Cursors=1 (# cursors opened by this proc=1)
E AndroidRuntime: at android.database.CursorWindow.(CursorWindow.java:104)
E AndroidRuntime: at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
E AndroidRuntime: at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:154)
E AndroidRuntime: at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:148)
E AndroidRuntime: at com.android.browser.provider.BrowserProvider2.shouldUpdateImages(BrowserProvider2.java:2064)
E AndroidRuntime: at com.android.browser.provider.BrowserProvider2.updateInTransaction(BrowserProvider2.java:1965)
E AndroidRuntime: at com.android.browser.provider.SQLiteContentProvider.update(SQLiteContentProvider.java:157)
E AndroidRuntime: at android.content.ContentProvider$Transport.update(ContentProvider.java:235)
E AndroidRuntime: at android.content.ContentResolver.update(ContentResolver.java:1016)
E AndroidRuntime: at com.android.browser.Controller$18.doInBackground(Controller.java:2764)
E AndroidRuntime: at com.android.browser.Controller$18.doInBackground(Controller.java:2740)
E AndroidRuntime: at android.os.AsyncTask$2.call(AsyncTask.java:287)
E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:234)
E AndroidRuntime: … 4 more