Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf ·...

54
3/31/2009 1 Michael Bond Kathryn McKinley The University of Texas at Austin

Transcript of Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf ·...

Page 1: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

1

Michael Bond Kathryn McKinley

The University of Texas at Austin

Page 2: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

2

http://www.codeproject.com/KB/showcase/IfOnlyWedUsedANTSProfiler.aspx

Driverless truck

10,000 lines of C#

http://www.codeproject.com/KB/showcase/IfOnlyWedUsedANTSProfiler.aspx

Driverless truck

10,000 lines of C#

Leak: past obstacles remained reachable

Page 3: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

3

http://www.codeproject.com/KB/showcase/IfOnlyWedUsedANTSProfiler.aspx

Driverless truck

10,000 lines of C#

Leak: past obstacles remained reachable No immediate symptoms

“This problem was pernicious because it only showed up after 40 minutes to an hour of driving around and collecting obstacles.”

http://www.codeproject.com/KB/showcase/IfOnlyWedUsedANTSProfiler.aspx

Driverless truck

10,000 lines of C#

Leak: past obstacles remained reachable No immediate symptoms

“This problem was pernicious because it only showed up after 40 minutes to an hour of driving around and collecting obstacles.”

Quick “fix”: restart after 40 minutes

Page 4: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

4

http://www.codeproject.com/KB/showcase/IfOnlyWedUsedANTSProfiler.aspx

Driverless truck

10,000 lines of C#

Leak: past obstacles remained reachable No immediate symptoms

“This problem was pernicious because it only showed up after 40 minutes to an hour of driving around and collecting obstacles.”

Quick “fix”: restart after 40 minutes Environment sensitive

More obstacles in deployed setting

Unresponsive after 28 minutes

Driverless truck

10,000 lines of C#

Leak: past obstacles remained reachable No immediate symptoms

“This problem was pernicious because it only showed up after 40 minutes to an hour of driving around and collecting obstacles.”

Quick “fix”: restart after 40 minutes Environment sensitive

More obstacles in deployed setting

Unresponsive after 28 minutes

Different environments & inputs different behavior

Uncertainty in deployed systems

Hard to fix before deployment

Page 5: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

5

Deployed systems have leaks

Critical systems need immediate help

Leak pruning tolerates bad effects

Reclaims memory automatically

High precision & low overhead

Bounds resources

Preserves semantics

Why tolerate leaks

Why leaks are so bad

How leak pruning works

How leak pruning predicts leaked objects

Evaluation

Page 6: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

6

Memory leaks are a real problem

Managed languages do not eliminate them

Memory leaks are a real problem

Managed languages do not eliminate them

Reachable

Page 7: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

7

Memory leaks are a real problem

Managed languages do not eliminate them

Reachable

Memory leaks are a real problem

Managed languages do not eliminate them

Live

ReachableDead

Page 8: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

8

Memory leaks are a real problem

Managed languages do not eliminate them

Live

ReachableDead

Memory leaks are a real problem

Managed languages do not eliminate them

Live

Reachable

Dead

Page 9: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

9

Memory leaks are a real problem

Managed languages do not eliminate them

LiveDead

Memory leaks are a real problem

Managed languages do not eliminate them

Slow & crash real programs

LiveDead

Page 10: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

10

Memory leaks are a real problem

Managed languages do not eliminate them

Slow & crash real programs

Unacceptable for some applications

Memory leaks are a real problem

Managed languages do not eliminate them

Slow & crash real programs

Unacceptable for some applications

Fixing leaks is hard

Leaks take time to materialize

Failure far from cause

Page 11: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

11

Why tolerate leaks

Why leaks are so bad

How leak pruning works

How leak pruning predicts leaked objects

Evaluation

Garbage collection based on liveness

Live

Reachable

Page 12: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

12

Garbage collection based on liveness

Take action when memory exhausted

Live

Reachable

Garbage collection based on liveness

Take action when memory exhausted

Live

ReachableDead

Page 13: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

13

Garbage collection based on liveness

Take action when memory exhausted

Live

DeadThrow OOM

error

Out of memory!

Garbage collection based on liveness

Take action when memory exhausted

Live

Dead

Out of memory!

Throw OOM error

Reclaim some objects

Page 14: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

14

Garbage collection based on liveness

Reclaim predicted dead objects

Live

Garbage collection based on liveness

Reclaim predicted dead objects

Live

Page 15: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

15

Garbage collection based on liveness

Reclaim predicted dead objects

Live

AB

Garbage collection based on liveness

Reclaim predicted dead objects

Live

A?

Page 16: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

16

Garbage collection based on liveness

Reclaim predicted dead objects

Poison references to reclaimed objects

Live

AX

Garbage collection based on liveness

Reclaim predicted dead objects

Poison references to reclaimed objects

Live

AX

Throw InternalErrorwith OOMErrorattached

Page 17: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

17

Garbage collection based on liveness

Reclaim predicted dead objects

Poison references to reclaimed objects

Live

AX

Throw InternalErrorwith OOMErrorattached

Worst case: defers fatal errors

Best case: keeps leaky programs running much

longer or indefinitely

Why tolerate leaks

Why leaks are so bad

How leak pruning works

How leak pruning predicts leaked objects

Evaluation

Page 18: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

18

Predicting the future Leaked objects not used again

Highly stale objects likely leaked[Chilimbi & Hauswirth ’04] [Qin et al. ’05] [Bond & McKinley ’06]

Predicting the future Leaked objects not used again

Highly stale objects likely leaked

Alternative: offload to disk [Melt, Bond & McKinley ’08][LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein et al. ’07, Breitgand et al. ’07]

Tolerates mispredictions

Eventually exhausts disk (if disk at all)

Page 19: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

19

Predicting the future Leaked objects not used again

Highly stale objects likely leaked

Alternative: offload to disk [Melt, Bond & McKinley ’08][LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein et al. ’07, Breitgand et al. ’07]

Tolerates mispredictions

Eventually exhausts disk (if disk at all)

Need high precision

One misprediction:program terminates

Identify references to prune

Roots of leaked data structures

Categorize by reference type

ParserInfoPreparedStatement

Page 20: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

20

Identify references to prune

Roots of leaked data structures

Categorize by reference type

Criteria

Highly stale references

▪ More stale than most stale instance accessed previously

ParserInfoPreparedStatement

MaxS&U

2-4 GCs

Identify references to prune

Roots of leaked data structures

Categorize by reference type

Criteria

Highly stale references

▪ More stale than most stale instance accessed previously

Reference type keeping most bytes reachable

ParserInfoPreparedStatement

MaxS&U

2-4 GCs

Size

132MB

Page 21: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

21

Identify references to prune

Roots of leaked data structures

Categorize by reference type

Criteria

Highly stale references

▪ More stale than most stale instance accessed previously

Reference type keeping most bytes reachable

Piggyback on GC: two-phase transitive closure

ParserInfoPreparedStatement

MaxS&U

2-4 GCs

Size

132MB

Based on colleague’s JDBC application

Leak: SQL statements remain in set

Page 22: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

22

HashSetParser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Page 23: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

23

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Page 24: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

24

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Page 25: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

25

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Page 26: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

26

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

0

0

0

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

20

0

0

Page 27: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

27

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

60

0

0

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

572

0

0

Page 28: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

28

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

572

0

0

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

572

244

0

Page 29: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

29

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

420M

180M

0

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

420M

180M

0

Page 30: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

30

HashSet

……

Parser

Info

Result

SetHash

Entry

Prepared

StatementField[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

Parser

Info

Result

Set

Hash

Entry

Prepared

Statement

Field[]

byte[][] byte[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

420M

180M

0

HashSet

……

Result

SetHash

Entry

Prepared

StatementField[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

420M

180M

0

Page 31: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

31

HashSet

……

Result

SetHash

Entry

Prepared

StatementField[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

0

0

0

HashSet

……

Result

SetHash

Entry

Prepared

StatementField[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

0

0

0

Page 32: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

32

HashSet

……

Result

SetHash

Entry

Prepared

StatementField[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

50M

220M

0

HashSet

……

Result

SetHash

Entry

Prepared

StatementField[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

50M

220M

0

Page 33: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

33

HashSet

……

Result

SetHash

Entry

Prepared

StatementField[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

Result

Set

Hash

Entry

Prepared

Statement

Field[]

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

50M

220M

0

HashSet

Hash

Entry

Prepared

Statement

Hash

Entry

Prepared

Statement

Hash

Entry

Prepared

Statement

HashEntry PreparedStatement

PreparedStatement ParserInfo

PreparedStatement ResultSet

MaxS&U

0-1

0-1

16-32

Bytes

50M

220M

0

Page 34: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

34

HashSet

Hash

Entry

Prepared

Statement

Hash

Entry

Prepared

Statement

Hash

Entry

Prepared

Statement

Algorithm efficientlyselects references to consistently unused

data structures based on type

Why tolerate leaks

Why leaks are so bad

How leak pruning works

How leak pruning predicts leaked objects

Evaluation

Page 35: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

35

Leak pruning added to Jikes RVM 2.9.2

http://www.jikesrvm.org/Research+Archive

Leak pruning added to Jikes RVM 2.9.2

http://www.jikesrvm.org/Research+Archive

Performance stress test

Non-leaking programs: DaCapo & SPEC benchmarks

Low overhead

▪ 3% (Core 2) or 5% (Pentium 4)

▪ Primarily read barriers

Page 36: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

36

Leak Leak pruning’s effect

Eclipse “Diff” Tolerates until 24-hr limit (>200X longer)

ListLeak Tolerates until 24-hr limit (>25,000X longer)

SwapLeak Tolerates until 24-hr limit (>2,200X longer)

Eclipse “Copy-Paste” Most dead but some live (81X longer)

MySQL Most dead but some live (35X longer)

JbbMod All dead but pruning misses some (21X longer)

SPECjbb2000 Heap growth is mostly live (4.7X longer)

Mckoi Database Thread leak: extra support needed (1.6X longer)

DualLeak Heap growth is live (No help)

Leak Leak pruning’s effect

Eclipse “Diff” Tolerates until 24-hr limit (>200X longer)

ListLeak Tolerates until 24-hr limit (>25,000X longer)

SwapLeak Tolerates until 24-hr limit (>2,200X longer)

Eclipse “Copy-Paste” Most dead but some live (81X longer)

MySQL Most dead but some live (35X longer)

JbbMod All dead but pruning misses some (21X longer)

SPECjbb2000 Heap growth is mostly live (4.7X longer)

Mckoi Database Thread leak: extra support needed (1.6X longer)

DualLeak Heap growth is live (No help)

Page 37: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

37

Leak Leak pruning’s effect

Eclipse “Diff” Tolerates until 24-hr limit (>200X longer)

ListLeak Tolerates until 24-hr limit (>25,000X longer)

SwapLeak Tolerates until 24-hr limit (>2,200X longer)

Eclipse “Copy-Paste” Most dead but some live (81X longer)

MySQL Most dead but some live (35X longer)

JbbMod All dead but pruning misses some (21X longer)

SPECjbb2000 Heap growth is mostly live (4.7X longer)

Mckoi Database Thread leak: extra support needed (1.6X longer)

DualLeak Heap growth is live (No help)

Leak Leak pruning’s effect

Eclipse “Diff” Tolerates until 24-hr limit (>200X longer)

ListLeak Tolerates until 24-hr limit (>25,000X longer)

SwapLeak Tolerates until 24-hr limit (>2,200X longer)

Eclipse “Copy-Paste” Most dead but some live (81X longer)

MySQL Most dead but some live (35X longer)

JbbMod All dead but pruning misses some (21X longer)

SPECjbb2000 Heap growth is mostly live (4.7X longer)

Mckoi Database Thread leak: extra support needed (1.6X longer)

DualLeak Heap growth is live (No help)

Page 38: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

38

Leak Leak pruning’s effect

Eclipse “Diff” Tolerates until 24-hr limit (>200X longer)

ListLeak Tolerates until 24-hr limit (>25,000X longer)

SwapLeak Tolerates until 24-hr limit (>2,200X longer)

Eclipse “Copy-Paste” Most dead but some live (81X longer)

MySQL Most dead but some live (35X longer)

JbbMod All dead but pruning misses some (21X longer)

SPECjbb2000 Heap growth is mostly live (4.7X longer)

Mckoi Database Thread leak: extra support needed (1.6X longer)

DualLeak Heap growth is live (No help)

Leak Leak pruning’s effect

Eclipse “Diff” Tolerates until 24-hr limit (>200X longer)

ListLeak Tolerates until 24-hr limit (>25,000X longer)

SwapLeak Tolerates until 24-hr limit (>2,200X longer)

Eclipse “Copy-Paste” Most dead but some live (81X longer)

MySQL Most dead but some live (35X longer)

JbbMod All dead but pruning misses some (21X longer)

SPECjbb2000 Heap growth is mostly live (4.7X longer)

Mckoi Database Thread leak: extra support needed (1.6X longer)

DualLeak Heap growth is live (No help)

Object[] Date

MaxS&U

16-32

Orderline String 0-1

Page 39: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

39

Leak Leak pruning’s effect

Eclipse “Diff” Tolerates until 24-hr limit (>200X longer)

ListLeak Tolerates until 24-hr limit (>25,000X longer)

SwapLeak Tolerates until 24-hr limit (>2,200X longer)

Eclipse “Copy-Paste” Most dead but some live (81X longer)

MySQL Most dead but some live (35X longer)

JbbMod All dead but pruning misses some (21X longer)

SPECjbb2000 Heap growth is mostly live (4.7X longer)

Mckoi Database Thread leak: extra support needed (1.6X longer)

DualLeak Heap growth is live (No help)

Leak Leak pruning’s effect

Eclipse “Diff” Tolerates until 24-hr limit (>200X longer)

ListLeak Tolerates until 24-hr limit (>25,000X longer)

SwapLeak Tolerates until 24-hr limit (>2,200X longer)

Eclipse “Copy-Paste” Most dead but some live (81X longer)

MySQL Most dead but some live (35X longer)

JbbMod All dead but pruning misses some (21X longer)

SPECjbb2000 Heap growth is mostly live (4.7X longer)

Mckoi Database Thread leak: extra support needed (1.6X longer)

DualLeak Heap growth is live (No help)

Reported on Eclipse Bugzilla

Leak: recursive difference

Automated with Eclipse Plugin

Page 40: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

40

Page 41: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

41

Page 42: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

42

Low footprint &often helps a lot

all-the-time deployed use

Page 43: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

43

Memory corruption & concurrency bugs Perturb layout & scheduling [Rx, Qin et al. ’05]

[DieHard, Berger & Zorn ’06] [Atom-Aid, Lucia et al. ’08] [Grace, Berger et al. ’08]

Fatal errors Ignore errors [Failure-oblivious computing, Rinard et al. ’04]

[Append, Dobolyi & Weimer ’08]

Memory corruption & concurrency bugs Perturb layout & scheduling [Rx, Qin et al. ’05]

[DieHard, Berger & Zorn ’06] [Atom-Aid, Lucia et al. ’08] [Grace, Berger et al. ’08]

Fatal errors Ignore errors [Failure-oblivious computing, Rinard et al. ’04]

[Append, Dobolyi & Weimer ’08]

Memory leaks in unmanaged languages Leak-friendly layout [Plug, Novark et al. ’08]

Bound allocation sites [Cyclic alloc, Nguyen & Rinard ’07]

Page 44: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

44

Finding leaks before deployment is hard

Deployed systems need immediate help

Leak pruning: GC based on liveness

High precision & low overhead

Bounded resources

Preserves semantics

Finding leaks before deployment is hard

Deployed systems need immediate help

Leak pruning: GC based on liveness

High precision & low overhead

Bounded resources

Preserves semantics

Thank you!

Page 45: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

45

Reported on Eclipse Bugzilla Recursive difference leaks memory

Page 46: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

46

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Piggyback on GC: two-phase transitive closure

First phase stops at highly stale references

No instance highly stale & accessed

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Garbage collector:for all objects o

o.staleness++;

Application:t = o.f;

t.staleness = 0;

Page 47: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

47

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Garbage collector:for all objects o

o.staleness++;

for all fields o.f

o.f |= 0x1;

Application:t = o.f;

if (t & 0x1) {

t &= ~0x1;

t.staleness = 0;

o.f = t; [atomic]

}

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Page 48: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

48

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Piggyback on GC: two-phase transitive closure

First phase stops at highly stale references

No instance highly stale & accessed

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Page 49: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

49

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Piggyback on GC: two-phase transitive closure

First phase stops at highly stale references

No instance highly stale & accessed

Second phase: bytes reachable from each ref

Reference type with most bytes: selected for pruning

Page 50: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

50

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Page 51: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

51

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Tree

EditorResource

Compare

Page 52: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

52

Editors

… ……

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Structural

Diff Data

Tree

EditorFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Tree

EditorResource

Compare

Editors

… ……

Structural

Diff DataFiltered

Node

Structural

Diff DataFiltered

Node

Structural

Diff DataFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Tree

EditorResource

Compare

Page 53: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

53

Editors

… ……

Structural

Diff DataFiltered

Node

Structural

Diff DataFiltered

Node

Structural

Diff DataFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Editors

… ……

Structural

Diff DataFiltered

Node

Structural

Diff DataFiltered

Node

Structural

Diff DataFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Filtered

NodeResource

Compare

Page 54: Michael Bond Kathryn McKinleyweb.cse.ohio-state.edu/~bond.213/leak-pruning-asplos-2009-talk.pdf · [Melt, Bond & McKinley ’08] [LeakSurvivor, Tang et al. ’08] [Panacea, Goldstein

3/31/2009

54

Editors

… ……

Structural

Diff DataFiltered

Node

Structural

Diff DataFiltered

Node

Structural

Diff DataFiltered

Node

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Filtered

NodeResource

Compare

Editors

… …

Editor

Editor

Editor Resource

Compare

Resource

Compare

Resource

Compare

Filtered

NodeResource

Compare