摘要
Android应用是一种事件驱动的并发程序。后台线程与异步事件执行顺序的不确定,导致数据竞争在Android应用中普遍存在。现有的针对Android应用的竞争检测工具会产生大量误报,且不能确定地重现竞争。针对以上问题,在现有的竞争检测结果的基础上,提出了一种基于测试用例生成的Android应用数据竞争验证方法。该方法首先构建应用的状态转化图,并基于状态转化图和现有竞争检测工具的检测结果自动生成包含潜在数据竞争的测试用例,然后在测试用例执行的过程中通过控制事件分发和线程的执行顺序来暴露竞争,观察竞争是否会引起程序异常。实验结果表明,该方法能有效地重现数据竞争引起的并发错误,并指出检测结果中的误报。
Android application is an event-based concurrent program.Data race is common in Android apps due to unforeseen threads interleaving coupled with non-deterministic reordering of asynchronous events.Existing race detection tools for Android applications will report false positive,and cannot replay the concurrent bugs caused by race.To address this issue,this paper proposed a new technique to expose race based on the results obtained from existing race detection tools.Our technique firstly builds state transition graph(STG)for targeted application,and generates a test case that has potential data races based on the STG and the results reported by existing race detection tools.Then it reschedules test cases execution by controlling event dispatching and thread interleaving to determine whether such potential races really lead to thrown exceptions.Our experiments show that this technique is effective,and it can confirm and replay concurrency bug caused by real data races,while at the same time eliminates false warnings for Android apps.
出处
《计算机科学》
CSCD
北大核心
2017年第11期27-32,共6页
Computer Science
基金
科技支撑(2015BAF05B01)
国家自然科学基金(61472407)资助