skip to main content
research-article
Open access

Exceptional situations and program reliability

Published: 14 March 2008 Publication History

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

[1]
Abrial, J.-R., Schuman, S. A., and Meyer, B. 1980. Specification language. In On the Construction of Programs. 343--410.
[2]
Aho, A., Sethi, R., and Ullman, J. 1986. Compilers: Principles, Techniques and Tools. Addison-Wesley, Reading, MA.
[3]
Alonso, G., Hagen, C., Agrawal, D., Abbadi, A. E., and Mohan, C. 2000. Enhancing the fault tolerance of workflow management systems. IEEE Concurr. 8, 3 (July), 74--81.
[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]
Ball, T. and Rajamani, S. K. 2001a. Automatically validating temporal safety properties of interfaces. In SPIN 2001, Workshop on Model Checking of Software. Lecture Notes in Computer Science, vol. 2057. Springer-Verlag, New York. 103--122.
[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]
Boehm, H.-J. 2003. Destructors, finalizers and synchronization. In Proceedings of the Symposium on Principles of Programming Languages. ACM, New York.
[8]
Borg, A., Blau, W., Graetsch, W., Herrmann, F., and Oberle, W. 1989. Fault tolerance under UNIX. ACM Trans. Comput. Syst. 7, 1 (Feb.).
[9]
Brown, A. and Patterson, D. 2003. Undo for operators: Building an undoable e-mail store. In USENIX Annual Technical Conference.
[10]
Bruntink, M., van Deursen, A., and Tourwé, T. 2006. Discovering faults in idiom-based exception handling. In ICSE '06: Proceeding of the 28th International Conference on Software Engineering. ACM, New York. 242--251.
[11]
Burke, M., Choi, J., Fink, S., Grove, D., Hind, M., Sarkar, V., Serrano, M., Sreedhar, V., Srinivasan, H., and Whaley, J. 1999. The jalapeno dynamic optimizing compiler for Java. In Proceedings of the ACM 1999 Java Grande Conference (San Francisco, CA). ACM, New York. 129--141.
[12]
Campione, M., Walrath, K., and Huml, A. 2000. The Java Tutorial. Addison-Wesley, Reading, MA.
[13]
Candea, G., Delgado, M., Chen, M., and Fox, A. 2003. Automatic failure-path inference: A generic introspection technique for internet applications. In Proceedings of the IEEE Workshop on Internet Applications (San Jose, CA). IEEE Computer Society Press, Los Alamitos, CA.
[14]
Cardelli, L. and Davies, R. 1999. Service combinators for web computing. Softw. Eng. 25, 3, 309--316.
[15]
Cargill, T. 1994. Exception handling: A false sense of security. C++ Report 6, 9.
[16]
Chang, B.-M., Jo, J.-W., Yi, K., and Choe, K.-M. 2001. Interprocedural exception analysis for Java. In SAC '01: Proceedings of the 2001 ACM Symposium on Applied Computing. ACM Press, New York. 620--625.
[17]
Chatterjee, R., Ryder, B. G., and Landi, W. 2001. Complexity of points-to analysis of Java in the presence of exceptions. IEEE Trans. Software Eng. 27, 6, 481--512.
[18]
Chen, M. Y., Kiciman, E., Fratkin, E., Fox, A., and Brewer, E. 2002. Pinpoint: Problem determination in large, dynamic Internet services. In Proceedings of the International Conference on Dependable Systems and Networks. IEEE Computer Society, Press, Los Alamitos, CA. 595--604.
[19]
Choi, J.-D., Grove, D., Hind, M., and Sarkar, V. 1999. Efficient and precise modeling of exceptions for the analysis of Java programs. In PASTE '99: Proceedings of the 1999 ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering. ACM, New York. 21--31.
[20]
Cristian, F. 1982. Exception handling and software fault tolerance. IEEE Trans. Comput. 31, 6, 531--540.
[21]
Cristian, F. 1987. Exception handling. Tech. Rep. RJ5724, IBM Research.
[22]
Dan, A., Dias, D. M., Nguyen, T., Sachs, M., Shaikh, H., King, R., and Duri, S. 1998. The Coyote project: Framework for multi-party e-commerce. In Proceedings of ECDL. Lecture Notes in Computer Science, vol. 1513. Springer-Verlag, New York. 873--889.
[23]
Das, M., Lerner, S., and Seigle, M. 2002. ESP: Path-sensitive program verification in polynomial time. SIGPLAN Notices 37, 5, 57--68.
[24]
Dayal, U., Hsu, M., and Ladin, R. 1990. Organizing long-running activities with triggers and transactions. In Proceedings of ACM SIGMOD (Atlantic City, NJ). ACM, New York. 204--214.
[25]
DeLine, R. and Fähndrich, M. 2001. Enforcing high-level protocols in low-level software. In Programming Language Design and Implementation. 59--69.
[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]
Dony, C. 2001. A fully object-oriented exception handling system. In Advances in Exception Handling Techniques. Lecture Notes in Computer Science, vol. 2022. Springer-Verlag, New York. 18--38.
[28]
Engler, D., Chelf, B., Chou, A., and Hallem, S. 2000. Checking system rules using system-specific, programmer-written compiler extensions. In Proceedings of the Symposium on Operating Systems Design and Implementation.
[29]
Fähndrich, M. and DeLine, R. 2002. Adoption and focus: Practical linear types for imperative programming. In Proceedings of the ACM Conference on Programming Language Design and Implementation. ACM, New York.
[30]
Fink, S., Yahav, E., Dor, N., Ramalingam, G., and Geay, E. 2006. Effective typestate verification in the presence of aliasing. In ISSTA '06: Proceedings of the 2006 International Symposium on Software Testing and Analysis. ACM, New York. 133--144.
[31]
Fu, C., Milanova, A., Ryder, B. G., and Wonnacott, D. 2005. Robustness testing of Java server applications. IEEE Trans. Softw. Eng. 31, 4, 292--311.
[32]
Fu, C., Ryder, B., Milanova, A., and Wannacott, D. 2004. Testing of Java web services for robustness. In Proceedings of the International Symposium on Software Testing and Analysis (ISSTA).
[33]
Garcia-Molina, H. and Salem, K. 1987. Sagas. In Proceedings of the ACM Conference on Management of Data. ACM, New York. 249--259.
[34]
Gay, D. and Aiken, A. 1998. Memory management with explicit regions. In Prog. Lang. Des. Implement. 313--323.
[35]
General Services Administration. 1996. Telecommunications: Glossary of Telecommunication terms. Tech. Rep. Federal Standard 1037C, National Communications System Technology & Standards Division. Aug.
[36]
Goodenough, J. B. 1975. Exception handling: issues and a proposed notation. Commun. ACM 18, 12, 683--696.
[37]
Gosling, J., Joy, B., and Steele, G. L. 1996. The Java Language Specification. The Java Series. Addison-Wesley, Reading, MA.
[38]
Gray, J. 1981. The transaction concept: virtues and limitations. In Proceedings of the International Conference on Very Large Data Bases (Cannes, France). ACM, New York. 144--154.
[39]
Gupta, M., Choi, J.-D., and Hind, M. 2000. Optimizing Java programs in the presence of exceptions. In ECOOP '00: Proceedings of the 14th European Conference on Object-Oriented Programming (London, UK). 422--446.
[40]
Hagen, C. and Alonso, G. 2000. Exception handling in workflow management systems. IEEE Trans. Software Engineering 26, 9 (Sept.), 943--959.
[41]
Hauswirth, M. and Chilimbi, T. 2004. Low-overhead memory leak detection using adaptive statistical profiling. In Proceedings of the Symposium on Architectural Support for Programming Languages and Operating Systems (ASPLOS).
[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]
Hopcroft, J. E., Motwani, R., and Ullman, J. D. 2000. Introduction to Automata Theory, Languages, and Computation (2nd Edition). Addison-Wesley.
[45]
Hovemeyer, D. and Pugh, W. 2004. Finding bugs is easy. In OOPSLA '04: Companion to the 19th Annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and applications. ACM, New York. 132--136.
[46]
Kildall, G. A. 1973. A unified approach to global program optimization. In Proceedings of the 1st Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages. ACM, New York. 194--206.
[47]
Korth, H. F., Levy, E., and Silberschatz, A. 1990. A formal approach to recovery by compensating transactions. VLDB J. 95--106.
[48]
Liblit, B., Aiken, A., Zheng, A. X., and Jordan, M. I. 2003. Bug isolation via remote program sampling. In Programming Language Design and Implementation (San Diego, CA).
[49]
Lindholm, T. and Yellin, F. 1997. The Java Virtual Machine Specification. The Java Series. Addison-Wesley, Reading, MA.
[50]
Liskov, B. and Scheifler, R. 1983. Guardians and actions: Linguistic support for robust, distributed programs. ACM Trans. Prog. Lang. Syst. 5, 3 (July), 381--404.
[51]
Liu, C., Orlowska, M. E., Lin, X., and Zhou, X. 2001. Improving backward recovery in workflow systems. In Proceedings of the Conference on Database Systems for Advanced Applications.
[52]
Lowell, D. E., Chandra, S., and Chen, P. M. 2000. Exploring failure transparency and the limits of generic recovery. In Proceedings of the USENIX Symposium on Operating Systems Design and Implementation.
[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]
Necula, G. C., McPeak, S., Rahul, S. P., and Weimer, W. 2002. Cil: An infrastructure for C program analysis and transformation. In Proceedings of the International Conference on Compiler Construction. 213--228.
[57]
Necula, G. C., McPeak, S., and Weimer, W. 2002. CCured: Type-safe retrofitting of legacy code. In Proceedings of the ACM Symposium on Principles of Programming Languages. ACM, New York. 128--139.
[58]
Odersky, M. and Wadler, P. 1997. Pizza into Java: Translating theory into practice. In Proceedings of the ACM Symposium on Principles of Programming Languages. ACM, New York. 146-- 159.
[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]
Reimer, D., Schonberg, E., Srinivas, K., Srinivasan, H., Alpern, B., Johnson, R. D., Kershenbaum, A., and Koved, L. 2004. Saber: Smart analysis based error reduction. SIGSOFT Softw. Eng. Notes 29, 4, 243--251.
[62]
Reps, T., Horwitz, S., and Sagiv, M. 1995. Precise interprocedural dataflow analysis via graph reachability. In Conference Record of POPL '95: 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (San Francisco, CA). ACM, New York. 49--61.
[63]
Robillard, M. P. and Murphy, G. C. 2003. Static analysis to support the evolution of exception structure in object-oriented systems. ACM Trans. Softw. Eng. Methodol. 12, 2, 191--221.
[64]
Ryder, B. G., Smith, D., Kremer, U., Gordon, M., and Shah, N. 2000. A static study of Java exceptions using jesp. In CC '00: Proceedings of the 9th International Conference on Compiler Construction (London, UK). Springer-Verlag, New York. 67--81.
[65]
Savage, S., Burrows, M., Nelson, G., Sobalvarro, P., and Anderson, T. 1997. Eraser: A dynamic data race detector for multithreaded programs. ACM Trans. Comput. Syst. 15, 4, 391--411.
[66]
Schmuck, F. and Wyllie, J. 1991. Experience with transactions in QuickSilver. In Proceedings of the 13th ACM SIGOPS Symposium on Operating Systems Principles. ACM, New York. 239-- 253.
[67]
Seltzer, M. I., Endo, Y., Small, C., and Smith, K. A. 1996. Dealing with disaster: Surviving misbehaved kernel extensions. In Proceedings of the Symposium on Operating Systems Design and Implementation (Seattle, WA). 213--227.
[68]
Shapiro, J. S., Smith, J. M., and Farber, D. J. 1999. EROS: A fast capability system. In Proceedings of the Symposium on Operating Systems Principles. 170--185.
[69]
Sinha, S. and Harrold, M. J. 1999. Criteria for testing exception-handling constructs in Java programs. In Proceedings of the International Conference on Software Maintenance (ICSM'99) (Oxford, England, UK, August 30--September 3). IEEE Computer Society, Online publication: http://computer.org/proceedings/icsm/0016/0016toc.htm, 265--276.
[70]
Sinha, S. and Harrold, M. J. 2000. Analysis and testing of programs with exception handling constructs. IEEE Trans. Softw. Eng. 26, 9, 849--871.
[71]
Sinha, S., Orso, A., and Harrold, M. J. 2004. Automated support for development, maintenance, and testing in the presence of implicit control flow. In Proceedings of the 27th International Conference on Software Engineering (ICSE 2005) (St. Louis, MO, May 15--21). ACM, New York. 336--345.
[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]
Stroustrup, B. 1991. The C++ Programming Language (second edition). Addison-Wesley, Reading, MA.
[75]
Sun Microsystems. 2001. Java pet store 1.1.2 blueprint application. http://java.sun.com/blueprints/code/. Tech. rep.
[76]
Tofte, M. and Talpin, J.-P. 1997. Region-based memory management. Inf. Comput.
[77]
Valetto, G. and Kaiser, G. 2002. A case study in software adaptation. In Proceedings of the ACM Workshop on Self-Healing Systems (WOSS '02). 73--78.
[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]
Weimer, W. and Necula, G. C. 2004. Finding and preventing run-time error handling mistakes. In OOPSLA '04: Proceedings of the 19th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications. ACM, New York. 419--431.
[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.

Cited By

View all
  • (2024)Broken Agreement: The Evolution of Solidity Error HandlingProceedings of the 18th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement10.1145/3674805.3686686(257-268)Online publication date: 24-Oct-2024
  • (2024)Cut to the Chase: An Error-Oriented Approach to Detect Error-Handling BugsProceedings of the ACM on Software Engineering10.1145/36607871:FSE(1796-1818)Online publication date: 12-Jul-2024
  • (2023)Effective handling of exceptional situations in robust software agentsIntelligenza Artificiale10.3233/IA-23000317:1(37-49)Online publication date: 7-Jun-2023
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Programming Languages and Systems
ACM Transactions on Programming Languages and Systems  Volume 30, Issue 2
March 2008
217 pages
ISSN:0164-0925
EISSN:1558-4593
DOI:10.1145/1330017
Issue’s Table of Contents
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: 14 March 2008
Accepted: 01 August 2007
Revised: 01 May 2007
Received: 01 December 2005
Published in TOPLAS Volume 30, Issue 2

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Error handling
  2. compensating transactions
  3. linear sagas
  4. linear types
  5. resource management

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)103
  • Downloads (Last 6 weeks)15
Reflects downloads up to 02 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Broken Agreement: The Evolution of Solidity Error HandlingProceedings of the 18th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement10.1145/3674805.3686686(257-268)Online publication date: 24-Oct-2024
  • (2024)Cut to the Chase: An Error-Oriented Approach to Detect Error-Handling BugsProceedings of the ACM on Software Engineering10.1145/36607871:FSE(1796-1818)Online publication date: 12-Jul-2024
  • (2023)Effective handling of exceptional situations in robust software agentsIntelligenza Artificiale10.3233/IA-23000317:1(37-49)Online publication date: 7-Jun-2023
  • (2023)Don’t Forget the Exception! : Considering Robustness Changes to Identify Design Problems2023 IEEE/ACM 20th International Conference on Mining Software Repositories (MSR)10.1109/MSR59073.2023.00064(417-429)Online publication date: May-2023
  • (2023)Detecting Exception Handling Bugs in C++ ProgramsProceedings of the 45th International Conference on Software Engineering10.1109/ICSE48619.2023.00098(1084-1096)Online publication date: 14-May-2023
  • (2023)Verifying Exception-Handling Code in Concurrent Libraries2023 30th Asia-Pacific Software Engineering Conference (APSEC)10.1109/APSEC60848.2023.00051(405-414)Online publication date: 4-Dec-2023
  • (2022)Which Exception Shall We Throw?Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering10.1145/3551349.3556895(1-12)Online publication date: 10-Oct-2022
  • (2022)Detecting Runtime Exceptions by Deep Code Representation Learning with Attention-Based Graph Neural Networks2022 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER)10.1109/SANER53432.2022.00053(373-384)Online publication date: Mar-2022
  • (2022)A comprehensive empirical study on bug characteristics of deep learning frameworksInformation and Software Technology10.1016/j.infsof.2022.107004151(107004)Online publication date: Nov-2022
  • (2021)funsies: A minimalist, distributed and dynamic workflow engineJournal of Open Source Software10.21105/joss.032746:66(3274)Online publication date: Oct-2021
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media