ContentProvider问题排查的adb命令

  • 检查服务端进程是否存活 (adb shell ps | grep <package>)

  • 检查服务端日志 (adb logcat | grep <provider>)

  • adb shell ps -T | grep pid | grep Binder

    • 如果线程数接近或达到上限(如16个),可能因线程耗尽导致阻塞

    • S 表示线程状态为 Sleeping(正常等待状态)

    • 如果出现 D(Uninterruptible Sleep)或 R(Running 且长时间不切换),则可能是死锁或阻塞。

    • adb shell "ps -A -T | grep pid | grep Binder",出现了很多com.huawei.hwid.core的线程,待查

  • 查看阻塞调用栈(oppo报错)adb shell am dumpheap [your_pid] /data/local/tmp/heap.hprof
  • 检查 Binder 状态(可能需要root)
    adb shell cat /sys/kernel/debug/binder/proc/[your_pid]
    观察 pending_work和 threads计数
    
  • Binder连接诊断(需要root)
    adb shell su root cat /sys/kernel/debug/binder/proc/[pid]
  • 强制回收Binder引用(需要root)
    adb shell su root am binder-heal [client-pid]
  • 监控Binder事务(需要root)
    adb shell su root cat /sys/kernel/debug/tracing/trace_pipe | grep Binder:
  • 检查Binder连接状态(报错)
    adb shell cat /proc/[client-pid]/fd | grep binder
  • 检查目标provider状态 
    adb shell dumpsys activity providers | grep -A 30 your.authority
  • 监控binder调用延迟 (No such file or directory)
    adb shell cat /sys/kernel/debug/tracing/trace_pipe | grep Binder
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值