17
Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chan dra IBM T.J. Watson Research Center, USA

Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

Embed Size (px)

Citation preview

Page 1: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

Effective Interprocedural Resource Leak Detection

ICSE 10

Emina Torlak Satish ChandraIBM T.J. Watson Research Center, USA

Page 2: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

AuthorEmina Torlak

Publications2010

MemSAT: checking axiomatic specifications of memory models Proceedings of the 2010 ACM SIGPLAN

Correct Refactoring of Concurrent Java Code 24th European Conference on Object-Oriented Programming (ECOOP)

2008

Controlled physical random functions and applications ACM Transactions on Information and System Security (TISSEC)

Page 3: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

AuthorSatish Chandra

Publications2010

Making defect-finding tools work for you ICSE

Programming with Angelic Non-determinism POPL

2009

Snugglebug: a powerful approach to weakest preconditions PLDI

2008

Verifying dereference safety via expanding-scope analysis ISSTA

Generating precise and concise procedure summaries POPL

Page 4: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

Related Publications in ICSE ’10

• LEAKPOINT: Pinpointing the Causes of Memory Leaks, James A. Clause and Alessandro Orso (Georgia Institute of Technology, Atlanta, USA)

• Efficient and precise Typestate Analysis by determining Continuation-equivalent States, Eric Bodden (Technische Universitaet Darmstadt, Germany)

• Precise Calling Context Encoding, William N. Sumner, Yunhui Zheng, Dasarath Weeratunge and Xiangyu Zhang (Purdue University, Lafayette, USA)

• Khasiana: Making Defect-Finding Tools Work for You, Mangala Gowri Nanda, Monika Gupta, Saurabh Sinha (IBM Research, India, India), Satish Chandra (IBM T.J. Watson Research Center, USA), David Schmidt (IBM Tivoli, USA), and Pradeep Balachandran (IBM Rational, India)

Page 5: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

Example

Exception might occur here

Exception expected here

Exception cause FileOutputStream instance never released!

Page 6: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

Contributions of “Tracker”

• Useful– the reports produced by the tool is actionable by a

user• Scalable

– the tool is able to handle real-world Java applications consisting of tens of thousands of classes

Page 7: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

Call edge

Page 8: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

p = new FileOutputStream(file)

P.close()

Page 9: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

Interprocedural Optimization

A method is RELEVANT to a fact <p,R,a> if it (or any of its transitive callees) contains a statement that may alter the fact's State. (much like slicing in some sense)

This optimization is fruitful, because in practice a lot of methods are auxiliary in nature

Page 10: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

COMPUTING ACTIONABLE REPORTS

• Prioritization

• Exception Flow– processes exceptional edges selectively– Customizable relevant exception types

• Nested Resources– Cluster reports around nested resources like:

FileOutputStream fos = new FileOutputStream(file);OutputStreamWriter osw = new OutputStreamWriter(fos, enc);...fos.close();

Page 11: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

Evaluation of Efficiency

Time used

Page 12: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

Results are the number of true positives and false positives generated by full exception edge flow. Base TP and FP are the results obtained by selective exception flow.

Evaluation of Exception Flow Filtering

The lower the better

The higher the better

Page 13: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

Comparison with Related Techniques

The higher the better

The higher the better

The lower the better

The lower the better

Page 14: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

CONCLUSION

Their contribution is in overcoming engineering challenges, using a blend of existing and new techniques.

An empirical evaluation of the tool showed its overall effectiveness.

Page 15: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

FUTURE WORK

• Discovering specifications automatically, especially with regards to identifying which pairs of types are related by a wrapper-wrappee relationship.

• Another promising direction is to extend the leak detection algorithm to automatically suggest code refactorings.

Page 16: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

REFERENCES

• M. Arnold, M. Vechev, and E. Yahav. QVM: an efficient runtime for detecting defects in deployed systems OOPSLA `07

• N. Ayewah, D. Hovemeyer, J. D. Morgenthaler, J. Penix, and W. Pugh. Using static analysis to find bugs IEEE Software `08

• R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph ACM TRANS PROG LANG

• M. Das, S. Lerner, and M. Seigle. Esp: Path-sensitive program verification in polynomial time PLDI `02

• N. Dor, S. Adams, M. Das, and Z. Yang. Software validation via scalable path-sensitive value flow analysis ISSTA `04

• T. Reps, S. Horwitz, and M. Sagiv. Precise interprocedural data flow analysis via graph reachability POPL `95

Page 17: Effective Interprocedural Resource Leak Detection ICSE 10 Emina Torlak Satish Chandra IBM T.J. Watson Research Center, USA

THANK YOU