Transcript
Page 1: Dynamic Bug Detection & Tolerance

Dynamic Bug Detection & Tolerance

Kathryn S McKinleyThe University of Texas at Austin

Page 2: Dynamic Bug Detection & Tolerance

Software Developer Dreams

Page 3: Dynamic Bug Detection & Tolerance

Software Developer Dreams

• Easy to implement specifications• Easy to get correct• Robust to errors of all sorts• Easy to maintain• Runs fast

Page 4: Dynamic Bug Detection & Tolerance

Realitythanks to David Callahan

Page 5: Dynamic Bug Detection & Tolerance

Software Developer Dreams

people-who-want-computers-to-do-things

• Easy to implement specifications• Easy to get correct• Robust to errors of all sorts

• Easy to maintain• Runs fast

Page 6: Dynamic Bug Detection & Tolerance

Software Developer Dreams

people-who-want-computers-to-do-things

• Easy to implement specifications• Easy to get correct learn & get

results• Robust to errors of all sorts

• Easy to maintain• Runs fast

Page 7: Dynamic Bug Detection & Tolerance

Software Developer Dreams

people-who-want-computers-to-do-things

• Easy to implement specifications• Easy to get correct learn & get

results• Robust to errors of all sorts

• Easy to maintain• Runs fast

Operating Environment SurvivesNo unrecoverable data lossNo observable implementation artifactsNo violations of security or privacy policies

Page 8: Dynamic Bug Detection & Tolerance

Software Developer Dreams

people-who-want-computers-to-do-things

• Easy to implement specifications• Easy to get correct learn & get

results• Robust to errors of all sorts

• Easy to maintain share• Runs fast enough and consistently

Operating Environment SurvivesNo unrecoverable data lossNo observable implementation artifactsNo violations of security or privacy policies

Page 9: Dynamic Bug Detection & Tolerance

Impediments to Reality & the Dream

Applications are more complicated– In 10 years, Windows grew from 10M to 50M lines– Application knowledge spread thin– Testing is not enough

Architectures are more complicated– Transistors on a chip [Moore’s law]:

• 180,000 transistors - First CMOS Vax 1987 • 291,000,000 transistors - Core2 Duo 2007

– Many coreThe glue is more complicated

– Dynamic optimization & runtime systems– Coordination of multiple languages and runtime

systems– Impossible to test all scenarios

Difficult to understand programs or runtime behavior

Page 10: Dynamic Bug Detection & Tolerance

Multi-pronged Approach to Correct High Performance

Software • Better languages

– Java and C# are not the last programming languages• Validation when possible

– We probably will not be able to validate substantial parallel applications any time soon

– Is application growth outpacing validation advances?• Analysis and development tools

– Static bug finding tools– Dynamic bug finding tools

• Self healing & dynamically updatable systems– Don’t crash

• Run Fast– New optimization opportunities

• move code & data around• use JIT to specialize to input data

• Evaluation

Page 11: Dynamic Bug Detection & Tolerance

Detect, Report, & Tolerate Bugs

• Memory errors– find leaks [Bond ASPLOS 2006, Jump POPL 2007]– tolerate leaks [Bond in progress]

• Null pointer exceptions– store a PC canary instead of zero for null [Bond et al. OOPSLA 2007]– keep running [Kent/Bond, in progress]

• Untested control paths & security holes– low cost probabilistic calling context [Bond OOPSLA 2007]

• Random semantic errors– data structure repair [Elkarablieh et al. OOPLSA 2007]– heap analysis [Jump in progress]– keep running [Kent/Bond in progress]

• Dynamic software updating – update software while it is running [Subramanian in progress]

Page 12: Dynamic Bug Detection & Tolerance

• Best case: increases GC workload• Worst case: systematic heap

growth causes crash after days of execution

A memory leak in a garbage-collected language occurs when a program inadvertently maintains references to objects that it no longer needs, preventing the collector from reclaiming space.

Cork accurately pinpoints systematicheap growth during production runs

Memory LeaksMaria Jump [POPL 2007]

Page 13: Dynamic Bug Detection & Tolerance

Cork’s Solution: Find growing data

structures1. Summarize heap objects by class &

reference relationships• Calculate class points-from graph• Piggyback on full-heap object scan

2. Difference the graphs3. Generate debugging reports• Candidate Report• Data Structure Slice Report• Allocation Site Report

Page 14: Dynamic Bug Detection & Tolerance

3

Class Points-From Graph

Heap

3

4

2

2

1

4

11

1

CPFG

=instance =class

=HashTable =Queue =Queue =Company =People

Page 15: Dynamic Bug Detection & Tolerance

Difference CPFGs

1

2

1

2

1

2

CPFGi1

11

Page 16: Dynamic Bug Detection & Tolerance

1

Difference CPFGs

1

2

1

2

2

3

2

1

CPFGi+1

1

2

2

3

CPFGi1

1

1

1

1

Page 17: Dynamic Bug Detection & Tolerance

1

Difference TPFGs

1

2

1

2

2

3

2

1

CPFGi+1

1

2

2

33

CPFGi1

1

1

1

1

2

Page 18: Dynamic Bug Detection & Tolerance

Difference TPFGs

1

2

1

2

CPFGi+2

1

4

1

1

1

2

4

CPFGi

1

1

11

1

1

12

3

2

1

CPFGi+1

2

33

1

1

2

Page 19: Dynamic Bug Detection & Tolerance

Eclipse 115789H

eap

Occ

up

ancy

(M

B)

Time (MB of allocation)

Page 20: Dynamic Bug Detection & Tolerance

Eclipse 115789: CPFG

• 3365 classes loaded (1773 in Eclipse)

• 667 nodes• 4090 edges

Page 21: Dynamic Bug Detection & Tolerance

Eclipse 115789: Candidates

Identify as candidates if rt < rthres

7 candidatesString[]

Object[]

ArrayListFolder

ResourceCompareInput$FilteredBufferedResourceNode

File

Path

Page 22: Dynamic Bug Detection & Tolerance

Eclipse 115789: SliceCalculate slice from each candidate:Set of all paths (n0…nn) s.t. rn(k+1)n(k)<0

String[]

Object[]

ArrayList

Folder

ResourceCompareInput$FilteredBufferedResourceNode

File

Path

Page 23: Dynamic Bug Detection & Tolerance

Slice Diagram

Path Folder

File

ResourceCompareInput$FilteredBufferedResourceNode ArrayList

Object[]

PropertyListenerList

RuleBasedCollator

ResourceCompareInput$MyDiffNode

HashMap$HashEntry

HashMap$HashEntry[]

HashMap

ResourceCompareInput

ElementTree$ChildIDsCache

ElementTree

Candidate

Non-candidate

String[]

JarFile

CompareConfiguration

IPath[]

Page 24: Dynamic Bug Detection & Tolerance

Eclipse 115789

Hea

p O

ccu

pan

cy (

MB

)

Time (MB of allocation)

Page 25: Dynamic Bug Detection & Tolerance

Tolerating Memory Leaks

[Mike Bond: work in progress]• Problem:

– Identified leaks take time to fix– In the mean time, they degrade

application and GC performance, or crash the program

• Solution: – Managed languages provide an

opportunity to reorganize memory

Page 26: Dynamic Bug Detection & Tolerance

Tolerating Memory Leaks

Stale SpaceIn-Use Space

E F

B

D

A C

Roots

G

Page 27: Dynamic Bug Detection & Tolerance

Tolerating Memory Leaks

Stale SpaceIn-Use Space

E F

B

D

A C

Roots

G

(1) Identify stale memory

Page 28: Dynamic Bug Detection & Tolerance

Tolerating Memory Leaks

Stale SpaceIn-Use Space

E

F

BA C

Roots

G

BstubBscion

D

(2) Move stale memory out of application & collector working set

Page 29: Dynamic Bug Detection & Tolerance

Tolerating Memory Leaks

Stale SpaceIn-Use Space

E

F

BA C

Roots

G

BstubBscion

D

(3) OS pages stale space to disk & compresses

it

Page 30: Dynamic Bug Detection & Tolerance

Tolerating Memory Leaks

Stale SpaceIn-Use Space

E

F

BA C

Roots

G

BstubBscion

(4) Activate object if touched

D

Page 31: Dynamic Bug Detection & Tolerance

Tolerating Memory Leaks

Stale SpaceIn-Use Space

E

F

BA C

Roots

G

BstubBscion

D

(4) Activate object if touched

Page 32: Dynamic Bug Detection & Tolerance

Tolerating Memory Leaks

Stale SpaceIn-Use Space

E

F

BA C

Roots

G

BstubBscion

Illusion of fixed leak!

D

Page 33: Dynamic Bug Detection & Tolerance

Throughput of Eclipse Leak

0

1000

2000

3000

4000

5000

6000

0 500 1000 1500 2000

Iteration

Time (ms)

Jikes RVM

Sun JVM

Melt

Page 34: Dynamic Bug Detection & Tolerance

Multi-pronged Approach to Correct High Performance

Software • Better languages

– Java and C# are not the last programming languages• Validation when possible

– We probably will not be able to validate substantial parallel applications any time soon

– Is application growth outpacing validation advances?• Analysis and development tools

– Static bug finding tools– Dynamic bug finding tools

• Self healing & dynamically updatable systems– Don’t crash

• Run Fast– New optimization opportunities

• move code & data around• use JIT to specialize to input data

• Evaluation

Page 35: Dynamic Bug Detection & Tolerance

Thank you!

www.dacapogroup.org


Top Related