ris*_*en0 2 android android-intent
有没有办法,无论是以编程方式还是通过调试工具,来了解Binder事务缓冲区中保存的当前事务?
有时,通常在运行几小时/几天后,我的应用程序崩溃并出现如下错误跟踪:
08-30 09:49:57.459 1879 1904 E JavaBinder: !!! FAILED BINDER TRANSACTION !!!
08-30 09:49:57.469 1879 1904 W BroadcastQueue: Exception when sending broadcast to ComponentInfo{com.mycompany.myapp/com.mycompany.myapp.receiver.UpdateContentReceiver}
08-30 09:49:57.469 1879 1904 W BroadcastQueue: android.os.TransactionTooLargeException
08-30 09:49:57.469 1879 1904 W BroadcastQueue: at android.os.BinderProxy.transact(Native Method)
08-30 09:49:57.469 1879 1904 W BroadcastQueue: at android.app.ApplicationThreadProxy.scheduleReceiver(ApplicationThreadNative.java:771)
08-30 09:49:57.469 1879 1904 W BroadcastQueue: at com.android.server.am.BroadcastQueue.processCurBroadcastLocked(BroadcastQueue.java:231)
08-30 09:49:57.469 1879 1904 W BroadcastQueue: at com.android.server.am.BroadcastQueue.processNextBroadcast(BroadcastQueue.java:778)
08-30 09:49:57.469 1879 1904 W BroadcastQueue: at com.android.server.am.BroadcastQueue$1.handleMessage(BroadcastQueue.java:140)
08-30 09:49:57.469 1879 1904 W BroadcastQueue: at android.os.Handler.dispatchMessage(Handler.java:99)
08-30 09:49:57.469 1879 1904 W BroadcastQueue: at android.os.Looper.loop(Looper.java:137)
08-30 09:49:57.469 1879 1904 W BroadcastQueue: at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1487)
Run Code Online (Sandbox Code Playgroud)
我试图发送的广播没有额外的内容,所以它的大小可以忽略不计.根据TransactionTooLargeException的文档 :
Binder事务缓冲区具有有限的固定大小,当前为1Mb,由进程正在进行的所有事务共享.因此,即使大多数单个事务的大小适中,当有许多事务正在进行时,也会抛出此异常.
我的想法是缓冲区被其他东西填满(我的应用程序,我正在使用的一个库或系统),当它几乎已满时,它会抛出TransactionTooLargeException.通过检查缓冲区的内容,我可以很容易地发现问题.
如http://www.slideshare.net/jserv/android-ipc-mechanism的幻灯片67中所示,可以通过debugfs找到有关Binder事务缓冲区的详细信息.安装后
mount -t debugfs none /sys/kernel/debug
Run Code Online (Sandbox Code Playgroud)
可以访问Binder信息/sys/kernel/debug/binder/,其中可以获得全局以及每个进程信息.
| 归档时间: |
|
| 查看次数: |
1836 次 |
| 最近记录: |