skip to main content
10.1145/2254064.2254126acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Fully automatic and precise detection of thread safety violations

Published:11 June 2012Publication History

ABSTRACT

Concurrent, object-oriented programs often use thread-safe library classes. Existing techniques for testing a thread-safe class either rely on tests using the class, on formal specifications, or on both. Unfortunately, these techniques often are not fully automatic as they involve the user in analyzing the output. This paper presents an automatic testing technique that reveals concurrency bugs in supposedly thread-safe classes. The analysis requires as input only the class under test and reports only true positives. The key idea is to generate tests in which multiple threads call methods on a shared instance of the tested class. If a concurrent test exhibits an exception or a deadlock that cannot be triggered in any linearized execution of the test, the analysis reports a thread safety violation. The approach is easily applicable, because it is independent of hand-written tests and explicit specifications. The analysis finds 15 concurrency bugs in popular Java libraries, including two previously unknown bugs in the Java standard library.

References

  1. API documentation of java.lang.StringBuffer (Java platform standard edition 6), 2011.Google ScholarGoogle Scholar
  2. C. Artho, K. Havelund, and A. Biere. High-level data races. Softw Test Verif Rel, 13(4):207--227, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  3. A. Bessey, K. Block, B. Chelf, A. Chou, B. Fulton, S. Hallem, C. Henri-Gros, A. Kamsky, S. McPeak, and D. R. Engler. A few billion lines of code later: Using static analysis to find bugs in the real world. Commun ACM, 53(2):66--75, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. S. Burckhardt and R. Tan. Private communication, August 2011.Google ScholarGoogle Scholar
  5. S. Burckhardt, C. Dern, M. Musuvathi, and R. Tan. Line-Up: a complete and automatic linearizability checker. In PLDI, pages 330--340, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. Burckhardt, P. Kothari, M. Musuvathi, and S. Nagarakatte. A randomized scheduler with probabilistic guarantees of finding bugs. In ASPLOS, pages 167--178, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. J. Burnim, T. Elmas, G. C. Necula, and K. Sen. NDSeq: runtime checking for nondeterministic sequential specifications of parallel correctness. In PLDI, pages 401--414, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. J.-D. Choi, K. Lee, A. Loginov, R. O'Callahan, V. Sarkar, and M. Sridharan. Efficient and precise datarace detection for multithreaded object-oriented programs. In PLDI, pages 258--269, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. I. Ciupa, A. Pretschner, A. Leitner, M. Oriol, and B. Meyer. On the predictability of random tests for object-oriented software. In ICST, pages 72--81, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. K. E. Coons, S. Burckhardt, and M. Musuvathi. GAMBIT: effective unit testing for concurrency libraries. In PPOPP, pages 15--24, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. C. Csallner and Y. Smaragdakis. JCrasher: an automatic robustness tester for Java. Software Pract Exper, 34(11):1025--1050, Sept. 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. O. Edelstein, E. Farchi, Y. Nir, G. Ratsaby, and S. Ur. Multithreaded Java program test generation. IBM Syst J, 41(1):111--125, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. T. Elmas, S. Tasiran, and S. Qadeer. VYRD: verifying concurrent programs by runtime refinement-violation detection. In PLDI, pages 27--37, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. C. Flanagan and S. N. Freund. Atomizer: a dynamic atomicity checker for multithreaded programs. In POPL, pages 256--267, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. C. Flanagan and S. N. Freund. FastTrack: efficient and precise dynamic race detection. In PLDI, pages 121--133, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. C. Flanagan, S. N. Freund, and J. Yi. Velodrome: a sound and complete dynamic atomicity checker for multithreaded programs. In PLDI, pages 293--303, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. P. Fonseca, C. Li, and R. Rodrigues. Finding complex concurrency bugs in large multi-threaded applications. In EuroSys, pages 215--228, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Q. Gao, W. Zhang, Z. Chen, M. Zheng, and F. Qin. 2ndstrike: toward manifesting hidden concurrency typestate bugs. In ASPLOS, pages 239--250, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. P. Godefroid, N. Klarlund, and K. Sen. DART: directed automated random testing. In PLDI, pages 213--223, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. B. Goetz, T. Peierls, J. Bloch, J. Bowbeer, D. Holmes, and D. Lea. Java Concurrency in Practice. 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. C. Hammer, J. Dolby, M. Vaziri, and F. Tip. Dynamic detection of atomic-set-serializability violations. In ICSE, pages 231--240, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. M. Herlihy and J. M. Wing. Linearizability: A correctnes condition for concurrent objects. ACM T Progr Lang Sys, 12(3):463--492, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. V. Jagannath, M. Gligoric, D. Jin, Q. Luo, G. Rosu, and D. Marinov. Improved multithreaded unit testing. In ESEC/FSE, pages 223--233, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. G. Jin, A. V. Thakur, B. Liblit, and S. Lu. Instrumentation and sampling strategies for cooperative concurrency bug isolation. In OOPSLA, pages 241--255, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. P. Joshi, C.-S. Park, K. Sen, and M. Naik. A randomized dynamic program analysis technique for detecting real deadlocks. In PLDI, pages 110--120, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. P. Joshi, M. Naik, K. Sen, and D. Gay. An effective dynamic analysis for detecting generalized deadlocks. In FSE, pages 327--336, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. S. Joshi, S. K. Lahiri, and A. Lal. Underspecified harnesses and interleaved bugs. In POPL, pages 19--30, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Z. Lai, S.-C. Cheung, and W. K. Chan. Detecting atomic-set serializability violations in multithreaded programs through active randomized testing. In ICSE, pages 235--244, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. S. Lu, J. Tucek, F. Qin, and Y. Zhou. AVIO: detecting atomicity violations via access interleaving invariants. In ASPLOS, pages 37--48, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. S. Lu, S. Park, E. Seo, and Y. Zhou. Learning from mistakes: a comprehensive study on real world concurrency bug characteristics. In ASPLOS, pages 329--339, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. B. Lucia and L. Ceze. Finding concurrency bugs with context-aware communication graphs. In MICRO, pages 553--563, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. D. Marino, M. Musuvathi, and S. Narayanasamy. LiteRace: effective sampling for lightweight data-race detection. In PLDI, pages 134--143, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. M. Musuvathi, S. Qadeer, T. Ball, G. Basler, P. A. Nainar, and I. Neamtiu. Finding and reproducing Heisenbugs in concurrent programs. In OSDI, pages 267--280, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. M. Naik, C.-S. Park, K. Sen, and D. Gay. Effective static deadlock detection. In ICSE, pages 386--396, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. A. Nistor, Q. Luo, M. Pradel, T. R. Gross, and D. Marinov. Ballerina: Automatic generation and clustering of efficient random unit tests for multithreaded code. In ICSE, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. R. O'Callahan and J.-D. Choi. Hybrid dynamic data race detection. In PPOPP, pages 167--178, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. C. Pacheco, S. K. Lahiri, M. D. Ernst, and T. Ball. Feedback directed random test generation. In ICSE, pages 75--84, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. C.-S. Park and K. Sen. Randomized active atomicity violation detection in concurrent programs. In FSE, pages 135--145, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. S. Park, S. Lu, and Y. Zhou. CTrigger: exposing atomicity violation bugs from their hiding places. In ASPLOS, pages 25--36, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. H. Patil, C. Pereira, M. Stallcup, G. Lueck, and J. Cownie. PinPlay: a framework for deterministic replay and reproducible analysis of parallel programs. In CGO, pages 2--11, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. W. Pugh and N. Ayewah. Unit testing concurrent software. In ASE, pages 513--516, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. S. Savage, M. Burrows, G. Nelson, P. Sobalvarro, and T. E. Anderson. Eraser: A dynamic data race detector for multithreaded programs. ACM T Comput Syst, 15(4):391--411, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. K. Sen. Effective random testing of concurrent programs. In ASE, pages 323--332, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. K. Sen. Race directed random testing of concurrent programs. In PLDI, pages 11--21, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. O. Shacham, N. Bronson, A. Aiken, M. Sagiv, M. Vechev, and E. Yahav. Testing atomicity of composed concurrent operations. In OOPSLA, pages 51--64, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Y. Shi, S. Park, Z. Yin, S. Lu, Y. Zhou, W. Chen, and W. Zheng. Do I use the wrong definition?: Defuse: definition-use invariants for detecting concurrency and sequential bugs. In OOPSLA, pages 160--174, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Y. Smaragdakis and C. Csallner. Combining static and dynamic reasoning for bug detection. In TAP, pages 1--16, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. F. Sorrentino, A. Farzan, and P. Madhusudan. PENELOPE: weaving threads to expose atomicity violations. In FSE, pages 37--46, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. C. von Praun and T. R. Gross. Object race detection. In OOPSLA, pages 70--82, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. S. Zhang, D. Saff, Y. Bu, and M. D. Ernst. Combined static and dynamic automated test generation. In ISSTA, pages 353--363, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. W. Zhang, C. Sun, and S. Lu. ConMem: detecting severe concurrency bugs through an effect-oriented approach. In ASPLOS, pages 179--192, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. W. Zhang, J. Lim, R. Olichandran, J. Scherpelz, G. Jin, S. Lu, and T. W. Reps. ConSeq: detecting concurrency bugs through sequential errors. In ASPLOS, pages 251--264, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Fully automatic and precise detection of thread safety violations

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          PLDI '12: Proceedings of the 33rd ACM SIGPLAN Conference on Programming Language Design and Implementation
          June 2012
          572 pages
          ISBN:9781450312059
          DOI:10.1145/2254064
          • cover image ACM SIGPLAN Notices
            ACM SIGPLAN Notices  Volume 47, Issue 6
            PLDI '12
            June 2012
            534 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/2345156
            Issue’s Table of Contents

          Copyright © 2012 ACM

          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]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 11 June 2012

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          PLDI '12 Paper Acceptance Rate48of255submissions,19%Overall Acceptance Rate406of2,067submissions,20%

          Upcoming Conference

          PLDI '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader