skip to main content
10.1145/2931037.2931068acmconferencesArticle/Chapter ViewAbstractPublication PagesisstaConference Proceedingsconference-collections
research-article

Efficient race detection in the presence of programmatic event loops

Published: 18 July 2016 Publication History

Abstract

An event loop is the basic scheduling mechanism for programs that respond to asynchronous events. In some frameworks, only the runtime can spin event loops, while in others, these can also be spun programmatically by event handlers. The latter provides more flexibility and helps improve responsiveness in cases where an event handler must wait for some input, for example, from the user or network. It can do so while spinning an event loop.
In this paper, we consider the scheduling scheme of programmatic event loops. Programs which follow this scheme are prone to interference between a handler that is spinning an event loop and another handler that runs inside the loop. We present a happens-before based race detection technique for such programs. We exploit the structure and semantics of executions of these programs to design a sparse representation of the happens-before relation. It relates only a few pairs of operations explicitly in such a way that the ordering between any pair of operations can be inferred from the sparse representation in constant time.
We have implemented our technique in an offline race detector for C/C++ programs, called SparseRacer. We discovered 13 new and harmful race conditions in 9 open-source applications using SparseRacer. So far, developers have confirmed 8 as valid bugs, and have fixed 3. These bugs arise from unintended interference due to programmatic event loops. Our sparse representation improved efficiency and gave an average speedup of 5x in race detection time.

References

[1]
docs.wxwidgets.org/3.0/classwx event loop base.html.
[2]
https://developer.mozilla.org/en-US/docs/Mozilla/ Tech/XPCOM/Reference/Interface/nsIThread.
[3]
https://www.chromium.org/developers/ design-documents/threading.
[4]
https://msdn.microsoft.com/en-us/library/system. windows.forms.application.doevents(v=vs.110).aspx.
[5]
developer.apple.com/library/mac/documentation/ corefoundation/Reference/CFRunLoopRef.
[6]
https://okular.kde.org/.
[7]
https://www.kde.org.
[8]
J. Afek and A. Sharabani. Dangling pointer: Smashing the pointer for fun and profit. Black Hat USA, 2007.
[9]
P. Bielik, V. Raychev, and M. Vechev. Scalable race detection for android applications. In OOPSLA, pages 332–348. ACM, 2015.
[10]
W. Choi, G. Necula, and K. Sen. Guided GUI testing of Android apps with minimal restart and approximate learning. In OOPSLA, pages 623–640. ACM, 2013.
[11]
C. Flanagan and S. N. Freund. Type-based race detection for Java. In PLDI, pages 219–232. ACM, 2000.
[12]
C. Flanagan and S. N. Freund. FastTrack: Efficient and precise dynamic race detection. In PLDI, pages 121–133. ACM, 2009.
[13]
C.-H. Hsiao, J. Yu, S. Narayanasamy, Z. Kong, C. L. Pereira, G. A. Pokam, P. M. Chen, and J. Flinn. Race detection for event-driven mobile applications. In PLDI, pages 326–336. ACM, 2014.
[14]
A. Itzkovitz, A. Schuster, and O. Zeev-Ben-Mordehai. Toward integration of data race detection in DSM systems. J. Parallel Distrib. Comput., 59(2):180–203, Nov. 1999.
[15]
H. V. Jagadish. A compression technique to materialize transitive closure. ACM Trans. Database Syst., 15(4):558–598, Dec. 1990.
[16]
V. Kahlon, N. Sinha, E. Kruus, and Y. Zhang. Static data race detection for concurrent programs with asynchronous calls. In FSE, pages 13–22. ACM, 2009.
[17]
L. Lamport. Time, clocks, and the ordering of events in a distributed system. Commun. ACM, pages 558–565, 1978.
[18]
C. Lattner and V. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In CGO. IEEE Computer Society, 2004.
[19]
P. Maiya, A. Kanade, and R. Majumdar. Race detection for Android applications. In PLDI, pages 316–325. ACM, 2014.
[20]
F. Mattern. Virtual time and global states of distributed systems. In Parallel and Distributed Algorithms, pages 215–226. North-Holland, 1988.
[21]
Z. Mednieks, L. Dornin, G. B. Meike, and M. Nakamura. Programming Android. O’Reilly, 2012.
[22]
M. Naik, A. Aiken, and J. Whaley. Effective static race detection for Java. In PLDI, pages 308–319. ACM, 2006.
[23]
N. Nethercote and J. Seward. Valgrind: A framework for heavyweight dynamic binary instrumentation. In PLDI, pages 89–100. ACM, 2007.
[24]
R. O’Callahan and J.-D. Choi. Hybrid dynamic data race detection. In PPoPP, pages 167–178. ACM, 2003.
[25]
J. Ousterhout. Why threads are a bad idea (for most purposes). Invited talk at USENIX, 1996.
[26]
V. S. Pai, P. Druschel, and W. Zwaenepoel. Flash: An efficient and portable web server. In USENIX, pages 199–212. USENIX Association, 1999.
[27]
B. Petrov, M. T. Vechev, M. Sridharan, and J. Dolby. Race detection for web applications. In PLDI, pages 251–262. ACM, 2012.
[28]
E. Pozniansky and A. Schuster. Efficient on-the-fly data race detection in multithreaded C++ programs. In PPoPP, pages 179–190. ACM, 2003.
[29]
M. Pradel, P. Schuh, G. C. Necula, and K. Sen. EventBreak: analyzing the responsiveness of user interfaces through performance-guided test generation. In OOPSLA, pages 33–47, 2014.
[30]
P. Pratikakis, J. S. Foster, and M. Hicks. LOCKSMITH: Practical static race detection for C. TOPLAS, 33(1):3:1–3:55, 2011.
[31]
V. Raychev, M. Vechev, and M. Sridharan. Effective race detection for event-driven programs. In OOPSLA, pages 151–166. ACM, 2013.
[32]
S. Savage, M. Burrows, G. Nelson, P. Sobalvarro, and T. Anderson. Eraser: A dynamic data race detector for multithreaded programs. TOCS, pages 391–411, 1997.
[33]
K. Serebryany, D. Bruening, A. Potapenko, and D. Vyukov. AddressSanitizer: A fast address sanity checker. USENIX ATC, pages 309–318. USENIX Association, 2012.
[34]
S. Souders. Even faster web sites: performance best practices for web developers. O’Reilly Media, Inc., 2009.
[35]
K. Veeraraghavan, P. M. Chen, J. Flinn, and S. Narayanasamy. Detecting and surviving data races using complementary schedules. In SOSP, pages 369–384. ACM, 2011.
[36]
J. W. Voung, R. Jhala, and S. Lerner. RELAY: Static race detection on millions of lines of code. In FSE, pages 205–214. ACM, 2007.
[37]
Y. Yu, T. Rodeheffer, and W. Chen. Racetrack: Efficient detection of data race conditions via adaptive tracking. In SOSP, pages 221–234. ACM, 2005.
[38]
X. Yuan and A. M. Memon. Using GUI run-time state as feedback to generate test cases. In ICSE, pages 396–405. IEEE Computer Society, 2007.
[39]
S. Zhang, H. Lü, and M. D. Ernst. Finding errors in multithreaded GUI applications. In ISSTA, pages 243–253, 2012.
[40]
W. Zhang, C. Sun, J. Lim, S. Lu, and T. W. Reps. ConMem: Detecting crash-triggering concurrency bugs through an effect-oriented approach. ACM Trans. Softw. Eng. Methodol., 22(2):10, 2013.
[41]
Y. Zheng, T. Bao, and X. Zhang. Statically locating web application bugs caused by asynchronous calls. In WWW, pages 805–814. ACM, 2011.

Cited By

View all
  • (2023)Tailoring Stateless Model Checking for Event-Driven Multi-threaded ProgramsAutomated Technology for Verification and Analysis10.1007/978-3-031-45332-8_9(176-198)Online publication date: 19-Oct-2023
  • (2021)Flaky test detection in Android via event order explorationProceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3468264.3468584(367-378)Online publication date: 20-Aug-2021
  • (2018)Efficiently manifesting asynchronous programming errors in Android appsProceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering10.1145/3238147.3238170(486-497)Online publication date: 3-Sep-2018
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ISSTA 2016: Proceedings of the 25th International Symposium on Software Testing and Analysis
July 2016
452 pages
ISBN:9781450343909
DOI:10.1145/2931037
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 18 July 2016

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Event driven programs
  2. Happens-before reasoning
  3. Race detection

Qualifiers

  • Research-article

Conference

ISSTA '16
Sponsor:

Acceptance Rates

Overall Acceptance Rate 58 of 213 submissions, 27%

Upcoming Conference

ISSTA '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)10
  • Downloads (Last 6 weeks)1
Reflects downloads up to 17 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2023)Tailoring Stateless Model Checking for Event-Driven Multi-threaded ProgramsAutomated Technology for Verification and Analysis10.1007/978-3-031-45332-8_9(176-198)Online publication date: 19-Oct-2023
  • (2021)Flaky test detection in Android via event order explorationProceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3468264.3468584(367-378)Online publication date: 20-Aug-2021
  • (2018)Efficiently manifesting asynchronous programming errors in Android appsProceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering10.1145/3238147.3238170(486-497)Online publication date: 3-Sep-2018
  • (2018)Practical AJAX race detection for JavaScript web applicationsProceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3236024.3236038(38-48)Online publication date: 26-Oct-2018
  • (2018)A Survey of Recent Trends in Testing Concurrent Software SystemsIEEE Transactions on Software Engineering10.1109/TSE.2017.270708944:8(747-783)Online publication date: 1-Aug-2018
  • (2017)Efficient computation of happens-before relation for event-driven programsProceedings of the 26th ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3092703.3092733(102-112)Online publication date: 10-Jul-2017

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media