当初遇到这个bug,是不定期的低概率出现,最后找到一个比较容易重现的步骤:
启动系统
然后进google +
新建一个帐号(注意是新建一个帐号)
没几步就重启了
这个BUG,一开始追踪也是无头绪的,在这个bug出现时,系统的debuggerd还是有些问题,pt_regs设置的和内核对应不上,tombstone的信息完全无用,core dump功能也是无法使用,唯一的线索就是一点点logcat的trace, trace如下:
D/OpenGLRenderer( 2021): Flushing caches (mode 1)
D/OpenGLRenderer( 2021): Flushing caches (mode 0)
D/OpenGLRenderer( 1986): Flushing caches (mode 1)
W/SurfaceTexture( 1451): freeAllBuffersLocked called but mQueue is not empty
D/OpenGLRenderer( 1986): Flushing caches (mode 0)
F/libc ( 1451): Fatal signal 11 (SIGSEGV) at 0x00000024 (code=1)
I/DEBUG ( 1449): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 1449): Build fingerprint: 'xxxx/IML74K/eng.freshui.20120213.154128:user/test-keys'
I/DEBUG ( 1449): pid: 1451, tid: 1455 >>> /system/bin/surfaceflinger <<<
I/DEBUG ( 1449): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000024
重现时的错误,基本上都是类似的trace。 从此入手开始查找。 Trace中的一句话:
W/SurfaceTexture( 1451): freeAllBuffersLocked called but mQueue is not empty
是最大的怀疑目标,基于捉虫的经验,先做假定,已经可以解释出错的原因和现象了:
- mQueue通常是被两个模块使用的,一个enqueue,一个dequeue
- 出错时,要将mQueue 给free掉,但mQueue不空,说明有人在用
- 如果不管这个警告,强行将mQueue给free掉,极有可能造成另外一个模块使用被free掉的内存而引起段错误
转回头看代码,SurfaceTexture.cpp, 查一下mQueue的使用地方,哪里有出现free buffer的时候,mQueue 不为空的可能? 排查一下,还真找到了,看下这个函数:
找到问题后,在freeAllBuffersLocked()调用之前,将mQueue给抽干一下,等使用的client都用完了再free就好了。
修改之后,再也没有碰到此类错误了。
当然此问题的排查和解决过程没这么顺利,也是搞了好几天的。 解决方法和问题原因也就不细说了,碰到并准备捉这个虫的同学应该会看明白的。
呵呵,这又是可以归结为 多线程同步/状态机 的问题,基本上目前我在Android碰到的严重问题都是这类了
分享到:
相关推荐
android-studio-ide-193.6514223-windows,解压资源
graphics.h图形库源码winBGIm(bug-free).rar,C++图形库,可用于基础图像显示
AndBug -- A Scriptable Android Debugger AndBug is a debugger targeting the Android platform's Dalvik virtual machine intended for reverse engineers and developers. It uses the same interfaces as ...
修复更新补丁后的组策略BUG-右键管理员运行,部分diy系统镜像精简后可能出现的组策略bug修复命令
Writing+Bug-Free+C+Code 源码 Writing+Bug-Free+C+Code 源码
Bug-报告的流程以及要素分析.zip程序开发文档软件开发文技术档下载Bug-报告的流程以及要素分析.zip程序开发文档软件开发文技术档下载Bug-报告的流程以及要素分析.zip程序开发文档软件开发文技术档下载Bug-报告的流程...
The latest code has bug fixes, iOS 7's (and up) style segment control (which has nice fade animation and tint) and support for Font Awesome. (These features has not been pushed to Maven yet) Using ...
描述了一种替代类方法,该方法提供了对C程序中对象的完整数据隐藏和容错运行时类型检查。
designer-bug-20120525,修正部分bug
python库,解压后可用。 资源全名:bugbug-0.0.14-py3-none-any.whl
资源来自pypi官网。 资源全名:bugbug-0.0.14-py3-none-any.whl
README This is my first Android Open Source project....The source is available at:http://github.com/beforemadness/Android---CSV-Contacts-Import ... So send any bug report to the above email.
一个不错得bug管理系统.功能虽然不是很强大,但是很实用,对于一般得项目都足够了,并且还可以自己改造用于其他得方面,如项目进度等 实用mysql,php编写.
帮助你快速掌握如何分析android bugreport
Android应用--简、美音乐播放器开发项目,修正一些bug的,可能还存在bug,请见谅哦
用于嵌入式软件静态分析测试工具-matlab polyspace bug finder
资源分类:Python库 所属语言:Python 使用前提:需要解压 资源全名:bugbug-0.0.57-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
Coordinated Effort This repository contains a collection of example custom behaviors for CoordinatorLayout part ... Bug fix contributions are welcome, but issues and feature requests will not be address
ChkBugReport是一个用于分析android的bugreport的开源工具,它可以把你得到的bugreprot导出成适合阅读的html。导出的html文件包含了根据bugreport数据得出的图表和分析结论,主要包括进程内存占用信息、程序ANR或...