|
ABSTRACT
It is difficult to write programs that behave correctly in the presence of run-time errors. Proper behavior in the face of exceptional situations is important to the reliability of long-running programs. Existing programming language features often provide poor support for executing clean-up code and for restoring invariants. We present a data-flow analysis for finding a certain class of exception-handling defects: those related to a failure to release resources or to clean up properly along all paths. Many real-world programs violate such resource usage rules because of incorrect exception handling. Our flow-sensitive analysis keeps track of outstanding obligations along program paths and does a precise modeling of control flow in the presence of exceptions. Using it, we have found over 1,300 exception handling defects in over 5 million lines of Java code. Based on those defects we propose a programming language feature, the compensation stack, that keeps track of obligations at run time and ensures that they are discharged. We present a type system for compensation stacks that tracks collections of obligations. Finally, we present case studies to demonstrate that this feature is natural, efficient, and can improve reliability.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
Abrial, J.-R., Schuman, S. A., and Meyer, B. 1980. Specification language. In On the Construction of Programs. 343--410.
|
| |
2
|
Alfred V. Aho , Ravi Sethi , Jeffrey D. Ullman, Compilers: principles, techniques, and tools, Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 1986
|
| |
3
|
|
| |
4
|
Alonso, G., Kamath, M., Agrawal, D., Abbadi, A. E., Gunthor, R., and Mohan, C. 1994. Failure handling in large-scale workflow management systems. Tech. Rep. RJ9913, IBM Almaden Research Center, San Jose, CA. Nov.
|
| |
5
|
|
| |
6
|
Ball, T. and Rajamani, S. K. 2001b. SLIC: A specification language for interface checking (of C). Tech. Rep. MSR-TR-2001-21, Microsoft Research.
|
 |
7
|
Hans-J. Boehm, Destructors, finalizers, and synchronization, Proceedings of the 30th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.262-272, January 15-17, 2003, New Orleans, Louisiana, USA
|
 |
8
|
|
| |
9
|
|
 |
10
|
|
 |
11
|
Michael G. Burke , Jong-Deok Choi , Stephen Fink , David Grove , Michael Hind , Vivek Sarkar , Mauricio J. Serrano , V. C. Sreedhar , Harini Srinivasan , John Whaley, The Jalapeño dynamic optimizing compiler for Java, Proceedings of the ACM 1999 conference on Java Grande, p.129-141, June 12-14, 1999, San Francisco, California, United States
[doi> 10.1145/304065.304113]
|
| |
12
|
Campione, M., Walrath, K., and Huml, A. 2000. The Java Tutorial. Addison-Wesley, Reading, MA.
|
| |
13
|
|
| |
14
|
|
| |
15
|
Cargill, T. 1994. Exception handling: A false sense of security. C++ Report 6, 9.
|
 |
16
|
Byeong-Mo Chang , Jang-Wu Jo , Kwangkeun Yi , Kwang-Moo Choe, Interprocedural exception analysis for Java, Proceedings of the 2001 ACM symposium on Applied computing, p.620-625, March 2001, Las Vegas, Nevada, United States
[doi> 10.1145/372202.372786]
|
| |
17
|
|
| |
18
|
Mike Y. Chen , Emre Kiciman , Eugene Fratkin , Armando Fox , Eric Brewer, Pinpoint: Problem Determination in Large, Dynamic Internet Services, Proceedings of the 2002 International Conference on Dependable Systems and Networks, p.595-604, June 23-26, 2002
|
 |
19
|
Jong-Deok Choi , David Grove , Michael Hind , Vivek Sarkar, Efficient and precise modeling of exceptions for the analysis of Java programs, Proceedings of the 1999 ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineering, p.21-31, September 06-06, 1999, Toulouse, France
|
| |
20
|
|
| |
21
|
Cristian, F. 1987. Exception handling. Tech. Rep. RJ5724, IBM Research.
|
| |
22
|
Asit Dan , Daniel M. Dias , Thao Nguyen , Marty Sachs , Hidayatullah Shaikh , Richard King , Sastry Duri, The Coyote Project: Framework for Multi-party E-Commerce, Proceedings of the Second European Conference on Research and Advanced Technology for Digital Libraries, p.873-889, September 21-23, 1998
|
 |
23
|
|
 |
24
|
Umeshwar Dayal , Meichun Hsu , Rivka Ladin, Organizing long-running activities with triggers and transactions, Proceedings of the 1990 ACM SIGMOD international conference on Management of data, p.204-214, May 23-26, 1990, Atlantic City, New Jersey, United States
|
 |
25
|
|
| |
26
|
Demsky, B. and Rinard, M. C. 2003. Automatic data structure repair for self-healing systems. In Proceedings of the ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications. ACM, New York.
|
| |
27
|
|
| |
28
|
Dawson Engler , Benjamin Chelf , Andy Chou , Seth Hallem, Checking system rules using system-specific, programmer-written compiler extensions, Proceedings of the 4th conference on Symposium on Operating System Design & Implementation, p.1-1, October 22-25, 2000, San Diego, California
|
 |
29
|
|
 |
30
|
Stephen Fink , Eran Yahav , Nurit Dor , G. Ramalingam , Emmanuel Geay, Effective typestate verification in the presence of aliasing, Proceedings of the 2006 international symposium on Software testing and analysis, July 17-20, 2006, Portland, Maine, USA
[doi> 10.1145/1146238.1146254]
|
| |
31
|
|
 |
32
|
Chen Fu , Barbara G. Ryder , Ana Milanova , David Wonnacott, Testing of java web services for robustness, Proceedings of the 2004 ACM SIGSOFT international symposium on Software testing and analysis, July 11-14, 2004, Boston, Massachusetts, USA
|
 |
33
|
|
 |
34
|
|
| |
35
|
General Services Administration. 1996. Telecommunications: Glossary of Telecommunication terms. Tech. Rep. Federal Standard 1037C, National Communications System Technology & Standards Division. Aug.
|
 |
36
|
|
| |
37
|
|
| |
38
|
|
| |
39
|
|
| |
40
|
|
 |
41
|
|
| |
42
|
Hejlsberg, A., Wilamuth, S., and Golde, P. 2003. The C# Programming Language. Addison-Wesley, Reading, MA.
|
| |
43
|
Hibernate. 2004. Object/relational mapping and transparent object persistence for Java and SQL databases. In http://www.hibernate.org/.
|
| |
44
|
John E. Hopcroft , Rajeev Motwani , Rotwani , Jeffrey D. Ullman, Introduction to Automata Theory, Languages and Computability, Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 2000
|
 |
45
|
David Hovemeyer , William Pugh, Finding bugs is easy, Companion to the 19th annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications, October 24-28, 2004, Vancouver, BC, CANADA
[doi> 10.1145/1028664.1028717]
|
 |
46
|
|
| |
47
|
|
 |
48
|
Ben Liblit , Alex Aiken , Alice X. Zheng , Michael I. Jordan, Bug isolation via remote program sampling, Proceedings of the ACM SIGPLAN 2003 conference on Programming language design and implementation, June 09-11, 2003, San Diego, California, USA
|
| |
49
|
|
 |
50
|
|
| |
51
|
|
| |
52
|
|
| |
53
|
Lowell, D. E. and Chen, P. M. 1998. Discount checking: transparent, low-overhead recovery for general applications. Tech. Rep. CSE-TR-410-99, University of Michigan. Nov.
|
| |
54
|
Malayeri, D. and Aldrich, J. 2006. Practical exception specifications. In Advanced Topics in Exception Handling Techniques, C. Dony, J. L. Knudsen, A. B. Romanovsky, and A. Tripathi, Eds. Lecture Notes in Computer Science, vol. 4119. Springer-Verlag, New York. 200--220.
|
| |
55
|
Miller, R. and Tripathi, A. 1997. Issues with exception handling in object-oriented systems. In Proceedings of the 11th European Conference on Object-Oriented Programming (ECOOP). 85--103.
|
| |
56
|
|
 |
57
|
|
 |
58
|
|
| |
59
|
O'Hanley, J. 2005. Always close streams. In http://www.javapractices.com/.
|
| |
60
|
Perry, E. H., Sanko, M., Wright, B., and Pfaeffle, T. 2002. Oracle9i JDBC developer's guide and reference. Tech. Rep. A96654-01 (Release 2 (9.2)), http://www.oracle.com. Mar.
|
 |
61
|
Darrell Reimer , Edith Schonberg , Kavitha Srinivas , Harini Srinivasan , Bowen Alpern , Robert D. Johnson , Aaron Kershenbaum , Larry Koved, SABER: smart analysis based error reduction, ACM SIGSOFT Software Engineering Notes, v.29 n.4, July 2004
|
 |
62
|
Thomas Reps , Susan Horwitz , Mooly Sagiv, Precise interprocedural dataflow analysis via graph reachability, Proceedings of the 22nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.49-61, January 23-25, 1995, San Francisco, California, United States
[doi> 10.1145/199448.199462]
|
 |
63
|
|
| |
64
|
|
 |
65
|
|
 |
66
|
|
 |
67
|
Margo I. Seltzer , Yasuhiro Endo , Christopher Small , Keith A. Smith, Dealing with disaster: surviving misbehaved kernel extensions, Proceedings of the second USENIX symposium on Operating systems design and implementation, p.213-227, October 29-November 01, 1996, Seattle, Washington, United States
|
 |
68
|
Jonathan S. Shapiro , Jonathan M. Smith , David J. Farber, EROS: a fast capability system, Proceedings of the seventeenth ACM symposium on Operating systems principles, p.170-185, December 12-15, 1999, Charleston, South Carolina, United States
|
| |
69
|
|
| |
70
|
|
| |
71
|
|
| |
72
|
SourceForge.net. 2003. About SourceForge.net (document A1). http://sourceforge.net. Tech. rep.
|
| |
73
|
Stallman, R., Pesch, R., and Shebs, S. 2002. Debugging with GDB. Free Software Foundation.
|
| |
74
|
|
| |
75
|
Sun Microsystems. 2001. Java pet store 1.1.2 blueprint application. http://java.sun.com/blueprints/code/. Tech. rep.
|
| |
76
|
|
 |
77
|
|
| |
78
|
van der Wal, S. 2002. Creating the C++ auto_ptr<> utility for Symbian OS. Tech. rep., http://www.symbian.com/developer/techlib/. Aug.
|
| |
79
|
Wagner, D., Foster, J. S., Brewer, E. A., and Aiken, A. 2000. A first step towards automated detection of buffer overrun vulnerabilities. In Proceedings of the Networking and Distributed System Security Symposium 2000 (San Diego, CA).
|
 |
80
|
Westley Weimer , George C. Necula, Finding and preventing run-time error handling mistakes, Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, October 24-28, 2004, Vancouver, BC, Canada
|
| |
81
|
Weimer, W. and Necula, G. C. 2005. Mining temporal specifications for error detection. Lecture Notes in Computer Science, vol. 3440. Springer-Verlag, New York. 461--476.
|
|