• Keine Ergebnisse gefunden

in Production

N/A
N/A
Protected

Academic year: 2022

Aktie "in Production"

Copied!
119
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Analyzing Memory Errors in Production

Markus Weninger

Johannes Kepler University Linz, Austria

Institute for System Software

(2)

WHO ARE WE?

Fixing Memory Problems In Production 2

(3)

WHO ARE WE?

Fixing Memory Problems In Production 2

(4)

WHO ARE WE?

Fixing Memory Problems In Production 2

(5)

WHO ARE WE?

Fixing Memory Problems In Production 2

(6)

WHO ARE WE?

Fixing Memory Problems In Production 2

(7)

WHO ARE WE?

Fixing Memory Problems In Production 2

(8)

WHO ARE WE?

For what?

To find and fix memory anomalies!

Fixing Memory Problems In Production 2

(9)

MOTIVATION

3 Fixing Memory Problems In Production

(10)

MOTIVATION

3 Fixing Memory Problems In Production

Jake

(11)

MOTIVATION

3 Fixing Memory Problems In Production

Jake

July

(12)

MOTIVATION

3 Fixing Memory Problems In Production

Jake

July

(13)

MOTIVATION

3 Fixing Memory Problems In Production

Jake

July

(14)

MOTIVATION

3 Fixing Memory Problems In Production

Jake

July

(15)

MOTIVATION

3 Fixing Memory Problems In Production

Jake

July

(16)

MOTIVATION

3 Fixing Memory Problems In Production

Jake

July

(17)

MOTIVATION

3 Fixing Memory Problems In Production

Jake

July

(18)

4 Fixing Memory Problems In Production

* not actually Jake

(19)

4 Fixing Memory Problems In Production

Why is my program crashing?

* not actually Jake

(20)

4 Fixing Memory Problems In Production

Why is my program crashing?

* not actually Jake

Let‘s try a

memory

analysis tool!

(21)

PROBLEM

5 Fixing Memory Problems In Production

(22)

PROBLEM

5 Fixing Memory Problems In Production

(23)

PROBLEM

5 Fixing Memory Problems In Production

(24)

PROBLEM

5 Fixing Memory Problems In Production

I am new to

all of this!

(25)

PROBLEM

5 Fixing Memory Problems In Production

I am new to all of this!

What should

I look for?

(26)

PROBLEM

5 Fixing Memory Problems In Production

I am new to all of this!

What should I look for?

When to use

which feature?

(27)

PROBLEM

5 Fixing Memory Problems In Production

I am new to all of this!

What should I look for?

When to use which feature?

<another question about memory

analysis> ...

(28)

POLL TIME

6 Fixing Memory Problems In Production

(29)

POLL TIME

6 Fixing Memory Problems In Production

0 1 2 3 4 5 6

Used a memory analysis tool before

Manually took a heap dump Knows what trace-based memory analysis is

Could describe what a

dominator tree is

Dummy Series 1 Dummy Series 2 Dummy Series 3

(30)

USERS NEED GUIDANCE

Fixing Memory Problems In Production 7

(31)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

(32)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

(33)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis

(34)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis

GC root

(35)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis

GC root

(36)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis

GC root

... ... ... ...

(37)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis

GC root

... ... ... ...

...

(38)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis

GC root

... ... ... ...

...

(39)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis

GC root

... ... ... ...

Which single object / GC root keeps the most other objects alive?

...

(40)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis Bottom-up analysis

GC root

... ... ... ...

Which single object / GC root keeps the most other objects alive?

...

(41)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis Bottom-up analysis

GC root

... ... ... ...

Which single object / GC root keeps the most other objects alive?

... ...

(42)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis Bottom-up analysis

GC root

... ... ... ...

Which single object / GC root keeps the most other objects alive?

... ...

(43)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis Bottom-up analysis

GC root

... ... ... ...

Which single object / GC root keeps the most other objects alive?

... ...

(44)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis Bottom-up analysis

GC root

... ... ... ...

Which single object / GC root keeps the most other objects alive?

... ...

(45)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis Bottom-up analysis

GC root

... ... ... ...

Which single object / GC root keeps the most other objects alive?

... ...

(46)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis Bottom-up analysis

GC root

... ... ... ...

Which single object / GC root keeps the most other objects alive?

GC root GC root

... ...

(47)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis Bottom-up analysis

GC root

... ... ... ...

Which single object / GC root keeps the most other objects alive?

GC root GC root

1 Mio. 10,000

10,000 10,000

1 Mio.

1 Mio.

... ...

(48)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis Bottom-up analysis

GC root

... ... ... ...

Which single object / GC root keeps the most other objects alive?

GC root GC root

1 Mio. 10,000

10,000 10,000

1 Mio.

1 Mio.

... ...

(49)

MEMORY ANALYSIS 101

Fixing Memory Problems In Production 8

Top-down analysis Bottom-up analysis

GC root

... ... ... ...

Which single object / GC root keeps the most other objects alive?

GC root GC root

1 Mio. 10,000

10,000 10,000

1 Mio.

1 Mio.

...

Analyze why a certain group of objects accumulates over time

...

(50)

DOMINATOR TREE

Fixing Memory Problems In Production 9

GC Roots

L1 L2

N1 N2 N3 N4 N5

D1 D2 D3 D4 D5

D6 D7 D8

N6 N7 N8 N9

N10

Object Reference Graph

(51)

DOMINATOR TREE

Fixing Memory Problems In Production 9

GC Roots

L1 L2

N1 N2 N3 N4 N5

D1 D2 D3 D4 D5

D6 D7 D8

N6 N7 N8 N9

N10

Dom. Tree Root

L1 L2

N1 N2 N3 N4 N5 D1

D2 D3 D4 D5

D6 D7

D8

N6 N7 N8 N9

N10

Object Reference Graph Dominator Tree

(52)

DOMINATOR TREE

Fixing Memory Problems In Production 10

GC Roots

L1 L2

N1 N2 N3 N4 N5

D1 D2 D3 D4 D5

D6 D7 D8

N6 N7 N8 N9

N10

Dom. Tree Root

L1 L2

N1 N2 N3 N4 N5 D1

D2 D3 D4 D5

D6 D7

D8

N6 N7 N8 N9

N10

Object Reference Graph Dominator Tree

(53)

DOMINATOR TREE

Fixing Memory Problems In Production 10

GC Roots

L1 L2

N1 N2 N3 N4 N5

D1 D2 D3 D4 D5

D6 D7 D8

N6 N7 N8 N9

N10

Dom. Tree Root

L1 L2

N1 N2 N3 N4 N5 D1

D2 D3 D4 D5

D6 D7

D8

N6 N7 N8 N9

N10

Object Reference Graph Dominator Tree

What happens if we could free L1?

(54)

DOMINATOR TREE

Fixing Memory Problems In Production 11

GC Roots

L1 L2

N1 N2 N3 N4 N5

D1 D2 D3 D4 D5

D6 D7 D8

N6 N7 N8 N9

N10

Dom. Tree Root

L1 L2

N1 N2 N3 N4 N5 D1

D2 D3 D4 D5

D6 D7

D8

N6 N7 N8 N9

N10

Object Reference Graph Dominator Tree

These can be

collected too

(55)

Fixing Memory Problems In Production 12

(56)

Fixing Memory Problems In Production 12

Thanks Markus, but that

seems like a lot to learn...

(57)

Fixing Memory Problems In Production 12

Thanks Markus, but that

seems like a lot to learn...

(58)

Fixing Memory Problems In Production 12

Thanks Markus, but that seems like a lot to learn...

Okay, let us try to

improve that in AntTracks

(59)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

(60)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X()

(61)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X()

(62)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X()

Trace

file

(63)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y()

Trace

file

(64)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z()

Trace

file

(65)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

Trace

file

(66)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move

Trace

file

(67)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move

Trace

file

(68)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

Trace

file

(69)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

new Y()

Trace

file

(70)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

new Y() new Z()

Trace

file

(71)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

new Y() new Z()

Trace file

AntTracks Analyzer Memory anomaly detection

Memory leak analysis

(72)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

new Y() new Z()

Trace file

AntTracks Analyzer Memory anomaly detection

Memory leak analysis

Heap 1

(73)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

new Y() new Z()

Trace file

AntTracks Analyzer Memory anomaly detection

Memory leak analysis

Heap 1

(74)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

new Y() new Z()

Trace file

AntTracks Analyzer Memory anomaly detection

Memory leak analysis

Heap 1 Heap 2

(75)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

new Y() new Z()

Trace file

AntTracks Analyzer Memory anomaly detection

Memory leak analysis

Heap 1 Heap 2 Heap n

(76)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

new Y() new Z()

Trace file

AntTracks Analyzer Memory anomaly detection

Memory leak analysis

Heap 1 Heap 2 Heap n

(77)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

new Y() new Z()

Trace file

AntTracks Analyzer Memory anomaly detection

Memory leak analysis

Heap 1 Heap 2 Heap n

(78)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

new Y() new Z()

Trace file

AntTracks Analyzer Memory anomaly detection

Memory leak analysis

Heap 1 Heap 2 Heap n

(79)

ANTTRACKS SYSTEM OVERVIEW

Fixing Memory Problems In Production 13

AntTracks VM Application t

M ut at or phase M ut . phase GC pha s e

new X() new Y() new Z() new Y()

move move move

new Y() new Z()

Trace file

AntTracks Analyzer Memory anomaly detection

Memory leak analysis

Heap 1 Heap 2 Heap n

(80)

GUIDED EXPLORATION

Fixing Memory Problems In Production 14

(81)

GUIDED EXPLORATION

Fixing Memory Problems In Production 14

Detection describes the task of automatically detecting a potential problem, i.e.,

a suspicious pattern.

(82)

GUIDED EXPLORATION

Fixing Memory Problems In Production 14

Detection describes the task of automatically detecting a potential problem, i.e., a suspicious pattern.

Highlighting the relevant region on the UI helps users to understand where the

automatically gained insight can be found if the view was inspected manually.

(83)

GUIDED EXPLORATION

Fixing Memory Problems In Production 14

Detection describes the task of automatically detecting a potential problem, i.e., a suspicious pattern.

Highlighting the relevant region on the UI helps users to understand where the automatically gained insight can be found if the view was inspected manually.

Explanation of the highlighted visualization helps users to interpret it and

explains concepts that are needed for this interpretation.

(84)

GUIDED EXPLORATION

Fixing Memory Problems In Production 14

Detection describes the task of automatically detecting a potential problem, i.e., a suspicious pattern.

Highlighting the relevant region on the UI helps users to understand where the automatically gained insight can be found if the view was inspected manually.

Explanation of the highlighted visualization helps users to interpret it and explains concepts that are needed for this interpretation.

Suggestions on which steps could / should be taken next make it easier for the

user to understand what operations are possible and why they might be useful.

(85)

GUIDED EXPLORATION

Fixing Memory Problems In Production 14

Detection describes the task of automatically detecting a potential problem, i.e., a suspicious pattern.

Highlighting the relevant region on the UI helps users to understand where the automatically gained insight can be found if the view was inspected manually.

Explanation of the highlighted visualization helps users to interpret it and explains concepts that are needed for this interpretation.

Suggestions on which steps could / should be taken next make it easier for the

user to understand what operations are possible and why they might be useful.

(86)

DEMO: EASYTRAVEL

Fixing Memory Problems In Production 15

(87)

DEMO: OVERVIEW

Fixing Memory Problems In Production 16

(88)

DEMO: OVERVIEW

(1) DETECTION + (2) HIGHLIGHTING

Fixing Memory Problems In Production 17

(89)

DEMO: OVERVIEW

(3) EXPLANATION + (4) SUGGESTION

Fixing Memory Problems In Production 18

(90)

DEMO: EVOLUTION

Fixing Memory Problems In Production 19

(91)

DEMO: EVOLUTION

Fixing Memory Problems In Production 20

(92)

DEMO: EVOLUTION

Fixing Memory Problems In Production 20

Date objects allocated in the constructor of Base are the major suspects for a memory leak since about 30% of the overall heap growth is accounted to them.

Inspect who keeps them alive.

(93)

DEMO: GRAPH VIEW

Fixing Memory Problems In Production 21

(94)

DEMO: GRAPH VIEW

Fixing Memory Problems In Production 22

(95)

DEMO: GRAPH VIEW

Fixing Memory Problems In Production 23

(96)

DEMO: GRAPH VIEW

Fixing Memory Problems In Production 23

(97)

DEMO: GRAPH VIEW

Fixing Memory Problems In Production 23

Too many ArrayList<Location>

are added here.

(98)

ANOTHER DEMO: FINAGLE-HTTP

Fixing Memory Problems In Production 24

(99)

ANOTHER DEMO: FINAGLE-HTTP

Fixing Memory Problems In Production 25

(100)

ANOTHER DEMO: FINAGLE-HTTP

Fixing Memory Problems In Production 26

(101)

ANOTHER DEMO: FINAGLE-HTTP

Fixing Memory Problems In Production 27

(102)

ANOTHER DEMO: FINAGLE-HTTP

Fixing Memory Problems In Production 27

(103)

ANOTHER DEMO: FINAGLE-HTTP

Fixing Memory Problems In Production 27

(104)

ANOTHER DEMO: FINAGLE-HTTP

Fixing Memory Problems In Production 27

(105)

ANOTHER DEMO: FINAGLE-HTTP

Fixing Memory Problems In Production 27

(106)

DEMO: FINAGLE-HTTP

val response: Future[http.Response] = client(request)

Fixing Memory Problems In Production 28

(107)

DEMO: FINAGLE-HTTP

val response: Future[http.Response] = client(request) for (i <- 0 until NUM_REQUESTS) {

Await.result(response.onSuccess { rep: http.Response =>

totalLength += rep.content.length })

}

Fixing Memory Problems In Production 28

(108)

DEMO: FINAGLE-HTTP

val response: Future[http.Response] = client(request) for (i <- 0 until NUM_REQUESTS) {

Await.result(response.onSuccess { rep: http.Response =>

totalLength += rep.content.length })

}

Fixing Memory Problems In Production 28

(109)

DEMO: FINAGLE-HTTP

val response: Future[http.Response] = client(request) for (i <- 0 until NUM_REQUESTS) {

Await.result(response.onSuccess { rep: http.Response =>

totalLength += rep.content.length })

}

val h = { rep: http.Response =>

totalLength += rep.content.length }

for (i <- 0 until NUM_REQUESTS {

Await.result(response.onSuccess(h)) }

Fixing Memory Problems In Production 28

(110)

DEMO: FINAGLE-HTTP

val response: Future[http.Response] = client(request) for (i <- 0 until NUM_REQUESTS) {

Await.result(response.onSuccess { rep: http.Response =>

totalLength += rep.content.length })

}

val h = { rep: http.Response =>

totalLength += rep.content.length }

for (i <- 0 until NUM_REQUESTS {

Await.result(response.onSuccess(h)) }

Fixing Memory Problems In Production 28

(111)

DEMO: FINAGLE-HTTP

val response: Future[http.Response] = client(request) for (i <- 0 until NUM_REQUESTS) {

Await.result(response.onSuccess { rep: http.Response =>

totalLength += rep.content.length })

}

val h = { rep: http.Response =>

totalLength += rep.content.length }

for (i <- 0 until NUM_REQUESTS {

Await.result(response.onSuccess(h)) }

Fixing Memory Problems In Production 28

(112)

DEMO: FINAGLE-HTTP

val response: Future[http.Response] = client(request) for (i <- 0 until NUM_REQUESTS) {

Await.result(response.onSuccess { rep: http.Response =>

totalLength += rep.content.length })

}

val h = { rep: http.Response =>

totalLength += rep.content.length }

for (i <- 0 until NUM_REQUESTS {

Await.result(response.onSuccess(h)) }

Fixing Memory Problems In Production 28

(113)

DEMO: FINAGLE-HTTP

val response: Future[http.Response] = client(request) for (i <- 0 until NUM_REQUESTS) {

Await.result(response.onSuccess { rep: http.Response =>

totalLength += rep.content.length })

}

val h = { rep: http.Response =>

totalLength += rep.content.length }

for (i <- 0 until NUM_REQUESTS {

Await.result(response.onSuccess(h)) }

Fixing Memory Problems In Production 28

(114)

TAKE-AWAYS

Fixing Memory Problems In Production 29

(115)

TAKE-AWAYS

Fixing Memory Problems In Production 29

Memory Analysis

Top-down Bottom-up Heap dumps

Trace-based

... and 100 other things

(116)

TAKE-AWAYS

Fixing Memory Problems In Production 29

Memory Analysis Problem

Top-down Bottom-up Heap dumps

Trace-based

... and 100 other things

New users need guidance to get

started faster It is not enough to

„throw tools at them“

(117)

TAKE-AWAYS

Fixing Memory Problems In Production 29

Memory Analysis Problem Guided Exploration

Top-down Bottom-up Heap dumps

Trace-based

... and 100 other things

New users need guidance to get

started faster It is not enough to

„throw tools at them“

Detection Highlighting

Explanation

Suggestion

(118)

TAKE-AWAYS

Fixing Memory Problems In Production 29

Memory Analysis Problem Guided Exploration

Top-down Bottom-up Heap dumps

Trace-based

... and 100 other things

New users need guidance to get

started faster It is not enough to

„throw tools at them“

Detection Highlighting

Explanation Suggestion

Markus Weninger

Johannes Kepler University

Linz, Austria

markus.weninger@jku.at

http://mevss.jku.at/AntTracks

http://bit.ly/weninger_ssw

(119)

Additional Notes

 Some icons made by Freepik & Smashicons from https://www.flaticon.com

 Some photos made by bruce mars and Isaque Pereira from Pexels

Fixing Memory Problems In Production 30

Referenzen

ÄHNLICHE DOKUMENTE

Since 2009 the DemokratieWEBstatt, the children’s webpage of the Austrian Parliament, has provided materials appropriate for use both in school and outside project work on each

The cointegration test, shown in Table 9, (see Engle &amp; Granger, 1987; Engle and Yoo, 1987, Table 2), shows that in the two cases with monthly data (models 5 and 6),

In order to demonstrate the instability of the Fermi sea against electron pairing Cooper introduced a simplified version of the Fr¨

8 Moreover, developing countries insisted on excluding the so-called “Singapore issues” from the negotiations. These issues, identified during the WTO First

Ceasefire/peace negotiations should therefore include representatives of the Assad regime, Syrian political opponents and armed rebels from the Free Syrian Army, and

 By clicking on the third icon, the user will be able to go to the main feed of the application (feed), where random photos uploaded by other users will be displayed

The BODC core reference may be used to link the data to header parameters in files COREINDX and EVENT. These files are linked together through field BEN. The primary key

These characteristics of the surface response to stratospheric westerly zonal wind changes are qualitatively consistent with the global surface solar signals from obser- vations