PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Precise Memory Leak Detection for Java Software Using Container Profiling.

Slides:



Advertisements
Similar presentations
TPTP 4.4 New Java Profiler (JVMTI) Test and Performance Tools Platform (TPTP) Heap Analysis Enhancements for TPTP 4.4 Asaf Yaffe Software and Solutions.
Advertisements

Uncovering Performance Problems in Java Applications with Reference Propagation Profiling PRESTO: Program Analyses and Software Tools Research Group, Ohio.
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Pallavi Joshi  Chang-Seo Park  Koushik Sen  Mayur Naik ‡  Par Lab, EECS, UC Berkeley‡
1 Write Barrier Elision for Concurrent Garbage Collectors Martin T. Vechev Cambridge University David F. Bacon IBM T.J.Watson Research Center.
Go with the Flow: Profiling Copies to Find Run-time Bloat Guoqing Xu, Matthew Arnold, Nick Mitchell, Atanas Rountev, Gary Sevitsky Ohio State University.
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Koushik Sen CS 265.
Overview Motivations Basic static and dynamic optimization methods ADAPT Dynamo.
IPOG: A General Strategy for T-Way Software Testing
Code Compaction of an Operating System Kernel Haifeng He, John Trimble, Somu Perianayagam, Saumya Debray, Gregory Andrews Computer Science Department.
Resurrector: A Tunable Object Lifetime Profiling Technique Guoqing Xu University of California, Irvine OOPSLA’13 Conference Talk 1.
Guoquing Xu, Atanas Rountev Ohio State University Oct 9 th, 2008 Presented by Eun Jung Park.
LOW-OVERHEAD MEMORY LEAK DETECTION USING ADAPTIVE STATISTICAL PROFILING WHAT’S THE PROBLEM? CONTRIBUTIONS EVALUATION WEAKNESS AND FUTURE WORKS.
CORK: DYNAMIC MEMORY LEAK DETECTION FOR GARBAGE- COLLECTED LANGUAGES A TRADEOFF BETWEEN EFFICIENCY AND ACCURATE, USEFUL RESULTS.
SOS: Saving Time in Dynamic Race Detection with Stationary Analysis Du Li, Witawas Srisa-an, Matthew B. Dwyer.
Vertically Integrated Analysis and Transformation for Embedded Software John Regehr University of Utah.
Establishing Local Temporal Heap Safety Properties with Applications to Compile-Time Memory Management Ran Shaham Eran Yahav Elliot Kolodner Mooly Sagiv.
CS 536 Spring Run-time organization Lecture 19.
Finding Low-Utility Data Structures Guoqing Xu 1, Nick Mitchell 2, Matthew Arnold 2, Atanas Rountev 1, Edith Schonberg 2, Gary Sevitsky 2 1 Ohio State.
Lecture 36: Programming Languages & Memory Management Announcements & Review Read Ch GU1 & GU2 Cohoon & Davidson Ch 14 Reges & Stepp Lab 10 set game due.
LeakChaser: Helping Programmers Narrow Down Causes of Memory Leaks Guoqing Xu, Michael D. Bond, Feng Qin, Atanas Rountev Ohio State University.
Age-Oriented Concurrent Garbage Collection Harel Paz, Erez Petrank – Technion, Israel Steve Blackburn – ANU, Australia April 05 Compiler Construction Scotland.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Regression Test Selection for AspectJ Software Guoqing Xu and Atanas.
Detecting Inefficiently-Used Containers to Avoid Bloat Guoqing Xu and Atanas Rountev Department of Computer Science and Engineering Ohio State University.
Applying Dynamic Analysis to Test Corner Cases First Penka Vassileva Markova Madanlal Musuvathi.
Bell: Bit-Encoding Online Memory Leak Detection Michael D. Bond Kathryn S. McKinley University of Texas at Austin.
Cmpt-225 Simulation. Application: Simulation Simulation  A technique for modeling the behavior of both natural and human-made systems  Goal Generate.
Precise Memory Leak Detection for Java Software Using Container Profiling Guoqing Xu, Atanas Rountev Program analysis and software tools group Ohio State.
Tolerating Memory Leaks Michael D. Bond Kathryn S. McKinley.
15-740/ Oct. 17, 2012 Stefan Muller.  Problem: Software is buggy!  More specific problem: Want to make sure software doesn’t have bad property.
Understanding Parallelism-Inhibiting Dependences in Sequential Java Programs Atanas (Nasko) Rountev Kevin Van Valkenburgh Dacong Yan P. Sadayappan Ohio.
Semantics-Aware Performance Optimization Harry Xu CS Departmental Seminar 01/13/2012.
Bug Localization with Machine Learning Techniques Wujie Zheng
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Dynamic Object Sampling for Pretenuring Maria Jump Department of Computer Sciences The University of Texas at Austin Stephen M. Blackburn.
Rethinking Soot for Summary-Based Whole- Program Analysis PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Dacong Yan.
Basic Semantics Associating meaning with language entities.
Chameleon Automatic Selection of Collections Ohad Shacham Martin VechevEran Yahav Tel Aviv University IBM T.J. Watson Research Center Presented by: Yingyi.
DoubleChecker: Efficient Sound and Precise Atomicity Checking Swarnendu Biswas, Jipeng Huang, Aritra Sengupta, and Michael D. Bond The Ohio State University.
OOPLs /FEN March 2004 Object-Oriented Languages1 Object-Oriented Languages - Design and Implementation Java: Behind the Scenes Finn E. Nordbjerg,
1 Test Selection for Result Inspection via Mining Predicate Rules Wujie Zheng
Speculative Region-based Memory Management for Big Data Systems Khanh Nguyen, Lu Fang, Harry Xu, Brian Demsky Donald Bren School of Information and Computer.
Static Detection of Loop-Invariant Data Structures Harry Xu, Tony Yan, and Nasko Rountev University of California, Irvine Ohio State University 1.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Efficient Checkpointing of Java Software using Context-Sensitive Capture.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
A Introduction to Computing II Lecture 11: Hashtables Fall Session 2000.
CoCo: Sound and Adaptive Replacement of Java Collections Guoqing (Harry) Xu Department of Computer Science University of California, Irvine.
Detecting Inefficiently-Used Containers to Avoid Bloat Guoqing Xu and Atanas Rountev Department of Computer Science and Engineering Ohio State University.
Consider Starting with 160 k of memory do: Starting with 160 k of memory do: Allocate p1 (50 k) Allocate p1 (50 k) Allocate p2 (30 k) Allocate p2 (30 k)
Power Analysis of Embedded Software : A Fast Step Towards Software Power Minimization 指導教授 : 陳少傑 教授 組員 : R 張馨怡 R 林秀萍.
Sept 12ICSM'041 Precise Identification of Side-Effect-Free Methods in Java Atanas (Nasko) Rountev Ohio State University.
Aritra Sengupta, Man Cao, Michael D. Bond and Milind Kulkarni PPPJ 2015, Melbourne, Florida, USA Toward Efficient Strong Memory Model Support for the Java.
Object Naming Analysis for Reverse- Engineered Sequence Diagrams Atanas (Nasko) Rountev Beth Harkness Connell Ohio State University.
GC Assertions: Using the Garbage Collector To Check Heap Properties Samuel Z. Guyer Tufts University Edward Aftandilian Tufts University.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
Beyond Application Profiling to System Aware Analysis Elena Laskavaia, QNX Bill Graham, QNX.
Dynamic Bug Detection & Tolerance Kathryn S McKinley The University of Texas at Austin.
Optimistic Hybrid Analysis
YAHMD - Yet Another Heap Memory Debugger
Cork: Dynamic Memory Leak Detection with Garbage Collection
Online Subpath Profiling
Liang Chen Advisor: Gagan Agrawal Computer Science & Engineering
Supporting Fault-Tolerance in Streaming Grid Applications
Storage.
Jipeng Huang, Michael D. Bond Ohio State University
Adaptive Code Unloading for Resource-Constrained JVMs
Demand-Driven Context-Sensitive Alias Analysis for Java
IPOG: A General Strategy for T-Way Software Testing
Dongyun Jin, Patrick Meredith, Dennis Griffith, Grigore Rosu
CS5123 Software Validation and Quality Assurance
Presentation transcript:

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Precise Memory Leak Detection for Java Software Using Container Profiling Guoqing Xu and Atanas Rountev Ohio State University Supported by NSF under CAREER grant CCF

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 2 Java Memory Leak  Memory leaks still exist in Java !! - Lost objects: unreachable but not freed - Useless objects: reachable but not used again  A Java memory leak can cause severe problems - Performance degradation - OutofMemory exception  It is difficult to detect such redundant objects - Static analysis may be of limited usefulness - Dynamic analysis is typically the “weapon of choice”

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Related Dynamic Approaches  Basic idea: from-symptom-to-cause-diagnosis - Track all objects during the execution - Find suspicious objects - Traverse the run-time object graph to find the cause  An orthogonal issue: the definition of symptom - Growing number of instances of a type (LeakBot ECOOP’05, Cork POPL’07) - Staleness (time since last use) of an object (Sleigh ASPLOS’06)  Problem: lack of precision

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Why Imprecise  Sources of imprecision - One single factor does NOT suffice to serve as leak symptom  Growth of #objects may not point to a leak  A JFrame object is never used since created, but is not a leak  Other factors that may contribute e.g. memory transitively consumed by an object - Hard to find the real cause from arbitrary objects We want a highly-precise report Can we consider the combination of multiple factors?

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 5 Outline  Motivation  Leak confidence analysis  Memory leak detection for Java  Experimental evaluation - Experience with real-world memory leaks - Run-time overhead

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University A New Perspective  Observation: containers are often the leak causes - Many JDK memory leak bugs are caused by misuse of containers  Let’s reverse the traditional diagnosis process - Start by suspecting that all containers are leaking, and use symptoms to rule out those less likely to leak - Avoid the effort to search for a cause from arbitrary objects

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Our Proposal  Container-centric - Tracking containers - Assign a confidence value to each container, based on the symptoms it shows - Rank containers based on confidence  We only find bugs caused by containers at the first and second levels of the tree  Other approaches could be used as supplement

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Leak Confidence Analysis  Consider the combined effect of multiple factors - Overall memory consumption - Memory taken up by an individual container - Staleness of a container  Container abstraction - An ADT with three operations ADD, GET, and REMOVE - ADD(  n, o):void - GET(  n ):o - REMOVE(  n, o):void  Confidence analysis - Conceptual, and can be implemented in different ways

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Leaking Region  Leaking region - A time region in which memory leak symptoms occur - Determined using GC events (  1,  2, …,  n ) - Defined as [  s,  e ] where the memory consumption at GC events keep growing  Decide on  e - Offline: the time at which the program ends or OutOfMemory exception is thrown - Online: any time when a user wants to generate a report  Determine  s - Backward traverse GC events from  e

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Leak-free Containers  A container  is considered to be leak-free - It is in state  0 at time  e (#REMOVE = #ADD), or - It is deallocated within the leaking region  Deallocation of  n is treated as n REMOVE operations  Container leak confidence - Memory contribution - Staleness contribution

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Memory Contribution  A memory-time-graph is captures a container’s memory footprint in the leaking region - X axis: time relative to  e - Y axis: memory consumed by all objects reachable from the container relative to total used memory MC (  ) = the area covered by the curve  [0, 1]

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Staleness Contribution  Time since last use [Bond and McKinley ASPLOS 06]  A new definition in terms of  and o - SC(o) = (  2 -  1 )/(  2 -  0 ) SC(  ) =  staleness(o)/ size(  ), o    [0, 1]

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Putting It All Together: Leak Confidence  SC is more important than MC  Increasing either SC or MC increases LC  Properties - MC = 0 and SC  [0, 1]  LC = 0 - SC = 0 and MC  [0, 1]  LC = 0 - SC = 1 and MC  [0, 1]  LC = 1 - MC = 1 and SC  [0, 1]  LC = SC LC = SC X MC 1-SC  [0, 1]

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Memory Leak Detection for Java  Modeling of container behavior - A glue class is built for each container class - A bridge method is used to connect a container method with one of the ADD, REMOVE, or GET operations  Instrumentation - Soot transformation framework  Profiling - JVMTI  Data analysis

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Modeling of Containers class HashMap{ Object put(Object key, Object value) {…} Object get(Object key) {…} Object remove(Object key) {…} } class Java_util_HashMap{ static void put_after (int csID, Map receiver, Object key, Object value, Object result) { if (result == null){ … Recorder.v().record(csID, receiver, key, …, Recorder.EFFECT_ADD); } } } Object result = map.put(a,b); Java_util_HashMap.put_after(1234, map, a, b, result);

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Profiling  Approximation of MC - An object graph traversal thread is launched periodically to calculate the total of amount of memory consumed by objects reachable from the container object - Precision and overhead tradeoff is defined by the interval between two runs of the thread - Our experience shows 1/50GC is an appropriate value

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Data Analysis  Identify leaking region  Compute the approximation of MC - MC =  M Ti X (T i+1 – T i )  Compute SC - Decompress data - Scan the data and remove data entries outside the leaking region - For each element, find its REMOVE site and its last GET site

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Experience with Detecting Memory Leak Bugs  Java AWT/Swing bugs - Sun JDK bug # – existed in Java 5, fixed in 6 - Sun JDK bug # – still open in Java 6  SPECjbb bug  The generated reports are precise - Top-ranked containers are the actual causes of the bugs - Confidence values for bug-inducing containers and correctly-used containers differ significantly

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Sun JDK Bug #  The bug manifests when switching between two Swing applications  According to a developer’s report, it is very hard to track down  We instrumented the entire java.awt and javax.swing packages, and the test case that triggered the bug

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Sun JDK Bug # Container: type: java.util.HashMap (LC: 0.443, SC: 0.480, MC: 0.855) ---cs: javax.swing.RepaintManager:591 Container: type: class java.util.LinkedList (LC: 0.145, SC:0.172, MC: 0.814) ---cs: java.awt.DefaultKeyboardFocusManager:738 Container: type: class javax.swing.JPanel (LC: 0.038, SC:0.044, MC: 0.860) ---cs: javax.swing.JComponent:796 Data analyzed in 21593ms

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Sun JDK Bug #  Line 591 of javax.swing.RepaintManager - An GET operation image = (VolatileImage) volatileMap.get(config); - The container that is misused is the volatileMap - This information may be sufficient for a developer to locate the bug  Where? - VolatileImage objects are cached in the map - Upon a display mode switch, the old configuration object get invalidated and will not used again - But the images are still maintained

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Overhead  Compile-time analysis  Dynamic overhead - Sampling rate: 1/15GC, 1/50GC - Initial heap size: default, 512k

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Overhead for Different Sampling Rates Y-axis: (NewTime-OldTime)/OldTime 1/15GC: 121.2% 1/50GC: 87.5%

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Overhead for Different Init Heap Size Default heap: 177.2% 512K heap: 87.5%

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Conclusions  Our approach is container-centric - Tracking all modeled containers - Computing a leak confidence for each container  Memory contribution  Staleness contribution - Can be used for both online and offline diagnosis  Memory leak detection for Java - Compiler assisted transformation - Profiling  Future work - Reduce overhead (e.g., selective profiling, JIKES RVM) - Automated detection of containers - Try other models