SlideShare ist ein Scribd-Unternehmen logo
1 von 64
Глубже стек-трейсов
Шире хип-дампов
Andrei Pangin
andrey.pangin@corp.mail.ru
2 Questions on StackOverflow
1. http://stackoverflow.com/questions/36343209/which-part-of-throwing-an-exception-is-expensive
2. http://stackoverflow.com/questions/26140182/running-jmap-getting-unable-to-open-socket-file
3. http://stackoverflow.com/questions/35517934/why-does-the-count-of-calls-of-a-recursive-method-causing-a-stackoverflowerror-v
4. http://stackoverflow.com/questions/28631656/runnable-thread-state-but-in-object-wait
5. http://stackoverflow.com/questions/26795573/which-method-is-the-least-obtrusive-for-generating-thread-dumps-in-java
6. http://stackoverflow.com/questions/25701740/java-thread-dump-waiting-on-object-monitor-what-is-it-waiting-on
7. http://stackoverflow.com/questions/36588354/how-to-dump-java-objects-came-from-jvm-heap-old-generation
8. http://stackoverflow.com/questions/30530082/how-can-i-restart-jvm-on-outofmemoryerror-after-making-a-heap-dump
9. http://stackoverflow.com/questions/28767905/what-is-the-difference-between-xss-and-xxthreadstacksize
10. http://stackoverflow.com/questions/25309748/what-is-thread-stack-size-option-xss-given-to-jvm-why-does-it-have-a-limit-of
11. http://stackoverflow.com/questions/35792936/how-to-take-a-heap-dump-in-windows-with-minimum-downtime
12. http://stackoverflow.com/questions/34076680/java-out-of-memory-automatic-heap-dump-file-name
13. http://stackoverflow.com/questions/26548103/how-to-obtain-the-jvm-thread-name-id-through-the-known-pid-tid
14. http://stackoverflow.com/questions/26116181/access-stacktraces-with-good-performance
15. http://stackoverflow.com/questions/23552296/how-to-determine-hotspot-vm-default-thread-stack-size
16. http://stackoverflow.com/questions/36458490/jni-how-to-list-all-the-current-instances
17. http://stackoverflow.com/questions/36279207/get-a-heap-dump-from-a-jre-only-on-windows
18. http://stackoverflow.com/questions/32605962/locate-and-read-objects-of-a-specific-type-from-memory-of-a-running-java-program
19. http://stackoverflow.com/questions/30629014/how-to-get-object-id-as-used-in-heap-dump
20. http://stackoverflow.com/questions/26502836/jmap-fforce-option-doesnt-work
21. http://stackoverflow.com/questions/25007427/how-are-exceptions-caught-and-dealt-with-at-the-low-assembly-level
22. http://stackoverflow.com/questions/23632653/generate-java-heap-dump-on-uncaught-exception
23. http://stackoverflow.com/questions/32198820/why-jstack-not-working-when-the-tmp-java-pidnum-socket-file-has-been-deleted
24. http://stackoverflow.com/questions/23247947/how-to-automatically-dump-memory-when-old-gen-of-jvm-exceeds-some-ratio
3 Exception traces
Exception in thread "main" java.net.UnknownHostException: nonexistent.com
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:211)
at TestConnection.main(TestConnection.java:6)
Demo 1
5
No stack trace
• Implicit exceptions
- NullPointerException
- ArrayIndexOutOfBoundsException
- ArithmeticException
- ArrayStoreException
- ClassCastException
• -XX:-OmitStackTraceInFastThrow
Exception traces
6 Exception traces
@Benchmark
public Object date() {
return new Date();
}
@Benchmark
public Object exception() {
return new Exception();
}
Benchmark Mode Cnt Score Error Units
Exception.date avgt 10 8,457 ± 0,040 ns/op
Exception.exception avgt 10 1208,841 ± 15,569 ns/op
7 Exception traces
public Throwable() {
fillInStackTrace();
}
public synchronized Throwable fillInStackTrace() {
if (stackTrace != null || backtrace != null) {
fillInStackTrace(0);
stackTrace = UNASSIGNED_STACK;
}
return this;
}
private native Throwable fillInStackTrace(int dummy);
8 Exception traces
@Benchmark
public Object exceptionNoStackTrace() {
return new Exception() {
@Override
public Throwable fillInStackTrace() {
return this;
}
};
}
Benchmark Mode Cnt Score Error Units
Exception.date avgt 10 8,457 ± 0,040 ns/op
Exception.exceptionNoStackTrace avgt 10 7,839 ± 0,034 ns/op
9 Exception traces
protected Exception(String message, Throwable cause,
boolean enableSuppression,
boolean writableStackTrace) {
public class LightException extends Exception {
public LightException(String message, Throwable cause) {
super(message, cause, true, false);
}
}
10 Exception traces
@Param({"1", "2", "10", "100", "1000"})
int depth;
@Benchmark
public Object throwCatch() {
try {
return recursive(depth);
} catch (Exception e) {
return e;
}
}
private Object recursive(int depth) throws Exception {
if (depth == 0) {
throw new LightException();
}
return recursive(depth - 1);
}
11 Exception traces
@Param({"1", "2", "10", "100", "1000"})
int depth;
@Benchmark
public Object throwCatch() {
try {
return recursive(depth);
} catch (Exception e) {
return e;
}
}
private Object recursive(int depth) throws Exception {
if (depth == 0) {
throw new LightException();
}
return recursive(depth - 1);
}
Benchmark (depth) Mode Cnt Score Error Units
Exceptions.throwCatch 1 avgt 10 8,020 ± 0,062 ns/op
Exceptions.throwCatch 2 avgt 10 126,724 ± 0,697 ns/op
Exceptions.throwCatch 10 avgt 10 620,068 ± 3,354 ns/op
Exceptions.throwCatch 100 avgt 10 5750,440 ± 34,838 ns/op
Exceptions.throwCatch 1000 avgt 10 58465,378 ± 251,693 ns/op
12 Exception traces
@Benchmark
public Object fillInStackTrace() {
return new Exception();
}
@Benchmark
public Object getStackTrace() {
return new Exception().getStackTrace();
}
Benchmark Mode Cnt Score Error Units
Exceptions.fillInStackTrace avgt 10 1207,092 ± 10,150 ns/op
Exceptions.getStackTrace avgt 10 13388,665 ± 54,684 ns/op
13 Exception traces
int depth = getStackTraceDepth();
stackTrace = new StackTraceElement[depth];
for (int i = 0; i < depth; i++)
stackTrace[i] = getStackTraceElement(i);
native calls
public final class StackTraceElement {
private String declaringClass;
private String methodName;
private String fileName;
private int lineNumber;
...
}
14 Exception traces
Exception in thread "main" java.net.UnknownHostException: nonexistent.com
at java.net.PlainSocketImpl.connect(java.base@9-ea/PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(java.base@9-ea/SocksSocketImpl.java:402)
at java.net.Socket.connect(java.base@9-ea/Socket.java:591)
at java.net.Socket.connect(java.base@9-ea/Socket.java:540)
at java.net.Socket.<init>(java.base@9-ea/Socket.java:436)
at java.net.Socket.<init>(java.base@9-ea/Socket.java:213)
at TestConnection.main(TestConnection.java:6)
public final class StackTraceElement {
private String moduleName;
private String moduleVersion;
private String declaringClass;
private String methodName;
private String fileName;
private int lineNumber;
new in JDK 9
15
Exception performance
• new Exception() is cheap
- fillInStackTrace() costs!
- getStackTrace() costs even more!
- O(stack_depth)
• throw is cheap
- catch ≈ goto in the same frame
- O(stack_depth)
Exception traces
16
Tips
• Use -XX:-OmitStackTraceInFastThrow
• No exceptions in normal control flow
• But if you really want
- use no-stack-trace constructor
Exception traces
When do you need stack traces?
18 Use cases
"Thread-1" #18 prio=5 os_prio=0 tid=0x1923a800 nid=0xdf8 waiting on condition [0x19faf000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0xd94cec48> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
at RpcTest.clientLoop(RpcTest.java:34)
at java.lang.Thread.run(Thread.java:745)
"Thread-2" #19 prio=5 os_prio=0 tid=0x19243800 nid=0x3d40 runnable [0x1a0af000]
java.lang.Thread.State: RUNNABLE
at one.nio.net.NativeSocket.readFully(Native Method)
at one.nio.rpc.RpcClient.invoke(RpcClient.java:76)
at RpcTest.clientLoop(RpcTest.java:36)
at java.lang.Thread.run(Thread.java:745)
19 Use cases
"Thread-1" #18 prio=5 os_prio=0 tid=0x1923a800 nid=0xdf8 waiting on condition [0x19faf000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0xd94cec48> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
at RpcTest.clientLoop(RpcTest.java:34)
at java.lang.Thread.run(Thread.java:745)
Locked ownable synchronizers:
- None
"Thread-2" #19 prio=5 os_prio=0 tid=0x19243800 nid=0x3d40 runnable [0x1a0af000]
java.lang.Thread.State: RUNNABLE
at one.nio.net.NativeSocket.readFully(Native Method)
at one.nio.rpc.RpcClient.invoke(RpcClient.java:76)
at RpcTest.clientLoop(RpcTest.java:36)
at java.lang.Thread.run(Thread.java:745)
Locked ownable synchronizers:
- <0xd94cec48> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
-XX:+PrintConcurrentLocks
20 Use cases
Logging
logger.warning("Operation timed out");
[Controller.java:123] WARNING: Operation timed out
public static String getLocation() {
StackTraceElement s = new Exception().getStackTrace()[2];
return s.getFileName() + ':' + s.getLineNumber();
}
21 Use cases
A better way?
Thread.current().getStackTrace()
public StackTraceElement[] getStackTrace() {
if (this != Thread.currentThread()) {
// ... some magic ...
} else {
// Don't need JVM help for current thread
return (new Exception()).getStackTrace();
}
}
22 Use cases
A better way!
public static String getLocation() {
StackTraceElement s = sun.misc.SharedSecrets.getJavaLangAccess()
.getStackTraceElement(new Exception(), 2);
return s.getFileName() + ':' + s.getLineNumber();
}
Not in
JDK 9
23
Caller sensitive methods
• @CallerSensitive
- Class.forName
- ResourceBundle.getBundle
- System.loadLibrary
- AccessController.doPrivileged
• sun.reflect.Reflection.getCallerClass
Use cases
24
Stack Walking API
• Limit depth
• Filter frames
• Lazy construction
• Class instances instead of Class names
Stack Walking API
25
java.lang.StackWalker
Stack Walking API
26
java.lang.StackWalker
• StackWalker.getInstance()
• StackWalker.getInstance(Set<Option> options)
- RETAIN_CLASS_REFERENCE
- SHOW_REFLECT_FRAMES
- SHOW_HIDDEN_FRAMES
• StackWalker.getInstance(Set<Option> options,
int estimateDepth)
Stack Walking API
27 Stack Walking API
StackWalker sw = StackWalker.getInstance();
sw.forEach(System.out::println);
StackWalking.dumpStackTrace(StackWalking.java:7)
StackWalking.main(StackWalking.java:12)
com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
28 Stack Walking API
StackWalker sw = StackWalker.getInstance(StackWalker.Option.SHOW_REFLECT_FRAMES);
sw.forEach(System.out::println);
StackWalking.dumpStackTrace(StackWalking.java:7)
StackWalking.main(StackWalking.java:12)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:531)
com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
29 Stack Walking API
StackWalker sw = StackWalker.getInstance(StackWalker.Option.SHOW_HIDDEN_FRAMES);
sw.forEach(System.out::println);
StackWalking.dumpStackTrace(StackWalking.java:7)
StackWalking$$Lambda$1/1287712235.run(Unknown Source bci:0)
StackWalking.main(StackWalking.java:12)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:531)
com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
30 Stack Walking API
public <T> T walk(Function<? super Stream<StackFrame>, ? extends T> function)
public static StackFrame getCallerFrame() {
return StackWalker.getInstance()
.walk(stream -> stream.skip(2).findFirst())
.orElseThrow(NoSuchElementException::new);
}
return StackWalker.getInstance(RETAIN_CLASS_REFERENCE).getCallerClass();
31 Stack Walking API
StackWalker sw = StackWalker.getInstance();
List<StackFrame> frames = sw.walk(stream ->
stream.filter(sf -> sf.getClassName().startsWith("com.jpoint."))
.limit(10)
.collect(Collectors.toList()));
public Stream<StackFrame> stream(); Why
NOT?
32
33 Stack size
Fun with recursion
static int depth;
static void recursion() {
depth++;
recursion();
}
public static void main(String[] args) {
recursion();
}
Demo 2
35 Stack size
4
3
2
1
main
2
1
main
3
4
5
6
2
1
main
3
4
5
6
7
8
C1
C1
C2
36
Stack size
• -Xss, -XX:ThreadStackSize
• Thread(threadGroup, target, name, stackSize)
• java.lang.OutOfMemoryError: Unable to create
new native thread
Stack size
37
Stack size
• Default stack size?
- x86: 320 KB
- x64: 1MB
• Minimum stack size?
- ~228 KB
Stack size
frame
empty
shadow
1
2
frame
frame
Profiling
39
Types of profiling
• Instrumentation
• Sampling
- Take stack traces every 10 – 100 ms
- Suitable for production
Profiling
public void someMethod(String... args) {
Profiler.onMethodEnter("myClass.someMethod");
// method body
Profiler.onMethodExit("myClass.someMethod");
}
Demo 3
41
Sampling bias
• Stack traces are taken at VM safepoint
• Running and idle threads are sampled equally
• Blocking native calls appear as Runnable
• Victims: VisualVM, JProfiler, YourKit…
Profiling
42
Fair profiler?
• setitimer + SIGPROF
• SIGPROF handler collects stack trace of signaled
thread
• HotSpot internal API: AsyncGetCallTrace
- Used in Oracle Solaris Studio
Profiling
43 Profiling
AsyncGetCallTrace
ASGCT_CallFrame frames[MAX_FRAMES];
ASGCT_CallTrace trace = {env, MAX_FRAMES, frames};
AsyncGetCallTrace(&trace, trace.num_frames, ucontext);
from signal handler
https://github.com/apangin/async-profiler
How to dump?
45
In-process
• Java
- Thread.getAllStackTraces
- ThreadMXBean.getThreadInfo
• JVMTI
- GetAllStackTraces
- Compact representation (jmethodID)
- Used by profilers
Thread dump
 StackTraceElement[]
46
External
• SIGQUIT (kill -3, Ctrl + )
- Processed by JVM at max. speed
- No intermediate structures
- Prints to stdout
• jstack
- Dynamic attach
• jstack -F
- Serviceability Agent
Thread dump
47 Thread dump
Dynamic attach
jstack JVM
1. creates .attach_pid1234
sends SIGQUIT 2. starts AttachListener
UNIX socket /tmp/.java_pid1234
verifies euid + egid
3. sends “threaddump” 4. executes command
sends output back to socket
48
jstack
• Pros.
- Performed by JVM at max. speed
- Compatibility with different JVM versions
• Cons.
- Should be run by the same user (euid / egid)
- Works only on healthy JVM
- Can be disabled (-XX:+DisableAttachMechanism)
Thread dump
49 Thread dump
Serviceability Agent
jstack -F JVM
1. PTRACE_ATTACH the process suspends
(SIGSTOP)
2. Read remote memory
PTRACE_PEEKDATA
3. Reconstruct VM structures
4. Traverse reconstructed stack
50
jstack -F
• Pros.
- No cooperation from JVM required
- root can dump any process
- Mixed Java+Natives frames (-m)
• Cons.
- Slow
- Requires the same version of JVM
- No thread names, no lock info
Thread dump
51 Thread dump
How to dump?
public static void dump() throws AttachNotSupportedException, IOException {
String vmName = ManagementFactory.getRuntimeMXBean().getName();
String pid = vmName.substring(0, vmName.indexOf('@'));
HotSpotVirtualMachine vm = (HotSpotVirtualMachine) VirtualMachine.attach(pid);
try {
vm.localDataDump();
} finally {
vm.detach();
}
}
https://github.com/odnoklassniki/one-nio/blob/master/src/one/nio/mgt/
Heap dump
53
jmap
• jmap -dump:live,format=b,file=heap.bin PID
• jmap -histo PID
Heap dump
num #instances #bytes class name
----------------------------------------------
1: 1943 404550984 [J
2: 5622 41517944 [B
3: 306128 33720768 [C
4: 292548 7021152 java.lang.String
5: 131072 4194304 one.nio.lock.RWLock
6: 103634 3316288 java.util.HashMap$Node
7: 89096 2138304 java.lang.Long
8: 17503 1850168 [Ljava.lang.Object;
9: 50688 1622016 [Lone.cassandra12.remoting.Host;
54 Heap dump
jmap vs. jmap -F
+ Speed
+ Version tolerance
+ Supports “live” option
- Requires the same user
- Works only on healthy JVM
+ Can be used on hung process
+ Can be used on core dump
+ root can dump everything
- Slow
- Requires the same JDK
- Heap may be inconsistent
jmap jmap -F
55 Heap dump
Offline heap dumps
$ sudo gcore 1234
$ jmap -dump:format=b,file=heap.bin /path/to/java core.1234
Windows: WinDbg.exe
jmap -dump:format=b,file=heap.bin C:pathtojava.exe core.mdmp
56
Automatic heap dumps
• -XX:+HeapDumpOnOutOfMemoryError
• -XX:+HeapDumpBeforeFullGC
• -XX:+HeapDumpAfterFullGC
• -XX:HeapDumpPath=/tmp (or /tmp/dump.bin)
Heap dump
57 Heap dump
Manageable options
HotSpotDiagnosticMXBean bean = ManagementFactory.newPlatformMXBeanProxy(
ManagementFactory.getPlatformMBeanServer(),
"com.sun.management:type=HotSpotDiagnostic",
HotSpotDiagnosticMXBean.class);
bean.setVMOption("HeapDumpOnOutOfMemoryError", "true");
bean.setVMOption("HeapDumpPath", fileName);
$ jinfo -flag +HeapDumpOnOutOfMemoryError 1234
$ jinfo -flag HeapDumpPath=/tmp 1234
58
Kill JVM after heap dump
• -XX:+ExitOnOutOfMemoryError
• -XX:+CrashOnOutOfMemoryError
Heap dump
$ java -XX:+HeapDumpOnOutOfMemoryError
-XX:OnOutOfMemoryError="kill -9 %p"
com.jpoint.TestApp
JDK
8u92
Dump heap programmatically
60 Heap dump
JMX
HotSpotDiagnosticMXBean bean = ManagementFactory.newPlatformMXBeanProxy(
ManagementFactory.getPlatformMBeanServer(),
"com.sun.management:type=HotSpotDiagnostic",
HotSpotDiagnosticMXBean.class);
bean.dumpHeap("/tmp/heap.bin", true);
61 Heap dump
JVMTI
jvmtiIterationControl JNICALL
HeapObjectCallback(jlong class_tag, jlong size,
jlong* tag_ptr, void* user_data) {
*tag_ptr = 1;
return JVMTI_ITERATION_CONTINUE;
}
jvmti->IterateOverInstancesOfClass(targetClass, JVMTI_HEAP_OBJECT_EITHER,
HeapObjectCallback, NULL);
jlong tag = 1;
jint count;
jobject* instances;
jvmti->GetObjectsWithTags(1, &tag, &count, &instances, NULL);
62 Heap dump
Serviceability Agent
SystemDictionary dictionary = VM.getVM().getSystemDictionary();
Klass klass = dictionary.find("java/lang/String", null, null);
VM.getVM().getObjectHeap().iterateObjectsOfKlass(new DefaultHeapVisitor() {
public boolean doObj(Oop obj) {
obj.printValue();
System.out.println();
return false;
}
}, klass); $JAVA_HOME/lib/sa-jdi.jar
63
Conclusions
• Use thread dumps and heap dumps
- In PROD!
• In-process
- Java (JMX), JVMTI
• Externally
- Dynamic attach
- Serviceability Agent
Heap dump
Thank you
@AndreiPangin

Weitere ähnliche Inhalte

Was ist angesagt?

Joker 2015 - Валеев Тагир - Что же мы измеряем?
Joker 2015 - Валеев Тагир - Что же мы измеряем?Joker 2015 - Валеев Тагир - Что же мы измеряем?
Joker 2015 - Валеев Тагир - Что же мы измеряем?tvaleev
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoinknight1128
 
Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaCharles Nutter
 
Riga Dev Day 2016 - Having fun with Javassist
Riga Dev Day 2016 - Having fun with JavassistRiga Dev Day 2016 - Having fun with Javassist
Riga Dev Day 2016 - Having fun with JavassistAnton Arhipov
 
Java Performance Puzzlers
Java Performance PuzzlersJava Performance Puzzlers
Java Performance PuzzlersDoug Hawkins
 
Csw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemesCsw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemesCanSecWest
 
JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015Charles Nutter
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84Mahmoud Samir Fayed
 
JavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistJavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistAnton Arhipov
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleAnton Arhipov
 
D Trace Support In My Sql Guide To Solving Reallife Performance Problems
D Trace Support In My Sql Guide To Solving Reallife Performance ProblemsD Trace Support In My Sql Guide To Solving Reallife Performance Problems
D Trace Support In My Sql Guide To Solving Reallife Performance ProblemsMySQLConference
 
Distributed systems at ok.ru #rigadevday
Distributed systems at ok.ru #rigadevdayDistributed systems at ok.ru #rigadevday
Distributed systems at ok.ru #rigadevdayodnoklassniki.ru
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistAnton Arhipov
 
Wait for your fortune without Blocking!
Wait for your fortune without Blocking!Wait for your fortune without Blocking!
Wait for your fortune without Blocking!Roman Elizarov
 
スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudy
スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudyスローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudy
スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudyYusuke Yamamoto
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Anton Arhipov
 
Jersey framework
Jersey frameworkJersey framework
Jersey frameworkknight1128
 
About Those Python Async Concurrent Frameworks - Fantix @ OSTC 2014
About Those Python Async Concurrent Frameworks - Fantix @ OSTC 2014About Those Python Async Concurrent Frameworks - Fantix @ OSTC 2014
About Those Python Async Concurrent Frameworks - Fantix @ OSTC 2014Fantix King 王川
 

Was ist angesagt? (20)

Joker 2015 - Валеев Тагир - Что же мы измеряем?
Joker 2015 - Валеев Тагир - Что же мы измеряем?Joker 2015 - Валеев Тагир - Что же мы измеряем?
Joker 2015 - Валеев Тагир - Что же мы измеряем?
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoin
 
Mastering Java ByteCode
Mastering Java ByteCodeMastering Java ByteCode
Mastering Java ByteCode
 
Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible Java
 
Riga Dev Day 2016 - Having fun with Javassist
Riga Dev Day 2016 - Having fun with JavassistRiga Dev Day 2016 - Having fun with Javassist
Riga Dev Day 2016 - Having fun with Javassist
 
Java Performance Puzzlers
Java Performance PuzzlersJava Performance Puzzlers
Java Performance Puzzlers
 
Csw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemesCsw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemes
 
JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84
 
JavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistJavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with Javassist
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassle
 
D Trace Support In My Sql Guide To Solving Reallife Performance Problems
D Trace Support In My Sql Guide To Solving Reallife Performance ProblemsD Trace Support In My Sql Guide To Solving Reallife Performance Problems
D Trace Support In My Sql Guide To Solving Reallife Performance Problems
 
Distributed systems at ok.ru #rigadevday
Distributed systems at ok.ru #rigadevdayDistributed systems at ok.ru #rigadevday
Distributed systems at ok.ru #rigadevday
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with Javassist
 
Wait for your fortune without Blocking!
Wait for your fortune without Blocking!Wait for your fortune without Blocking!
Wait for your fortune without Blocking!
 
スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudy
スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudyスローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudy
スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudy
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
 
About Those Python Async Concurrent Frameworks - Fantix @ OSTC 2014
About Those Python Async Concurrent Frameworks - Fantix @ OSTC 2014About Those Python Async Concurrent Frameworks - Fantix @ OSTC 2014
About Those Python Async Concurrent Frameworks - Fantix @ OSTC 2014
 
Thread dumps
Thread dumpsThread dumps
Thread dumps
 

Ähnlich wie Down to Stack Traces, up from Heap Dumps

Don't dump thread dumps
Don't dump thread dumpsDon't dump thread dumps
Don't dump thread dumpsTier1app
 
Thread dump troubleshooting
Thread dump troubleshootingThread dump troubleshooting
Thread dump troubleshootingJerry Chan
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Ontico
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby SystemsEngine Yard
 
Using apache spark for processing trillions of records each day at Datadog
Using apache spark for processing trillions of records each day at DatadogUsing apache spark for processing trillions of records each day at Datadog
Using apache spark for processing trillions of records each day at DatadogVadim Semenov
 
Kickin' Ass with Cache-Fu (without notes)
Kickin' Ass with Cache-Fu (without notes)Kickin' Ass with Cache-Fu (without notes)
Kickin' Ass with Cache-Fu (without notes)err
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerJAX London
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Michael Barker
 
Solr Troubleshooting - TreeMap approach
Solr Troubleshooting - TreeMap approachSolr Troubleshooting - TreeMap approach
Solr Troubleshooting - TreeMap approachAlexandre Rafalovitch
 
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...Lucidworks
 
Lets crash-applications
Lets crash-applicationsLets crash-applications
Lets crash-applicationsTier1 app
 
Varnish presentation for the Symfony Zaragoza user group
Varnish presentation for the Symfony Zaragoza user groupVarnish presentation for the Symfony Zaragoza user group
Varnish presentation for the Symfony Zaragoza user groupJorge Nerín
 
mri ruby gil
mri ruby gilmri ruby gil
mri ruby gilachempion
 
톰캣 #09-쓰레드
톰캣 #09-쓰레드톰캣 #09-쓰레드
톰캣 #09-쓰레드GyuSeok Lee
 
Analysis bottleneck in J2EE application
Analysis bottleneck in J2EE applicationAnalysis bottleneck in J2EE application
Analysis bottleneck in J2EE applicationTerry Cho
 
Find bottleneck and tuning in Java Application
Find bottleneck and tuning in Java ApplicationFind bottleneck and tuning in Java Application
Find bottleneck and tuning in Java Applicationguest1f2740
 
A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVMRafael Winterhalter
 

Ähnlich wie Down to Stack Traces, up from Heap Dumps (20)

Don't dump thread dumps
Don't dump thread dumpsDon't dump thread dumps
Don't dump thread dumps
 
Thread dump troubleshooting
Thread dump troubleshootingThread dump troubleshooting
Thread dump troubleshooting
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby Systems
 
Solr @ Etsy - Apache Lucene Eurocon
Solr @ Etsy - Apache Lucene EuroconSolr @ Etsy - Apache Lucene Eurocon
Solr @ Etsy - Apache Lucene Eurocon
 
Using apache spark for processing trillions of records each day at Datadog
Using apache spark for processing trillions of records each day at DatadogUsing apache spark for processing trillions of records each day at Datadog
Using apache spark for processing trillions of records each day at Datadog
 
Kickin' Ass with Cache-Fu (without notes)
Kickin' Ass with Cache-Fu (without notes)Kickin' Ass with Cache-Fu (without notes)
Kickin' Ass with Cache-Fu (without notes)
 
Exception Handling in Scala
Exception Handling in ScalaException Handling in Scala
Exception Handling in Scala
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael Barker
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!
 
Solr Troubleshooting - TreeMap approach
Solr Troubleshooting - TreeMap approachSolr Troubleshooting - TreeMap approach
Solr Troubleshooting - TreeMap approach
 
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...
 
JVM Mechanics
JVM MechanicsJVM Mechanics
JVM Mechanics
 
Lets crash-applications
Lets crash-applicationsLets crash-applications
Lets crash-applications
 
Varnish presentation for the Symfony Zaragoza user group
Varnish presentation for the Symfony Zaragoza user groupVarnish presentation for the Symfony Zaragoza user group
Varnish presentation for the Symfony Zaragoza user group
 
mri ruby gil
mri ruby gilmri ruby gil
mri ruby gil
 
톰캣 #09-쓰레드
톰캣 #09-쓰레드톰캣 #09-쓰레드
톰캣 #09-쓰레드
 
Analysis bottleneck in J2EE application
Analysis bottleneck in J2EE applicationAnalysis bottleneck in J2EE application
Analysis bottleneck in J2EE application
 
Find bottleneck and tuning in Java Application
Find bottleneck and tuning in Java ApplicationFind bottleneck and tuning in Java Application
Find bottleneck and tuning in Java Application
 
A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVM
 

Kürzlich hochgeladen

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyAnusha Are
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456KiaraTiradoMicha
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 

Kürzlich hochgeladen (20)

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 

Down to Stack Traces, up from Heap Dumps

  • 2. 2 Questions on StackOverflow 1. http://stackoverflow.com/questions/36343209/which-part-of-throwing-an-exception-is-expensive 2. http://stackoverflow.com/questions/26140182/running-jmap-getting-unable-to-open-socket-file 3. http://stackoverflow.com/questions/35517934/why-does-the-count-of-calls-of-a-recursive-method-causing-a-stackoverflowerror-v 4. http://stackoverflow.com/questions/28631656/runnable-thread-state-but-in-object-wait 5. http://stackoverflow.com/questions/26795573/which-method-is-the-least-obtrusive-for-generating-thread-dumps-in-java 6. http://stackoverflow.com/questions/25701740/java-thread-dump-waiting-on-object-monitor-what-is-it-waiting-on 7. http://stackoverflow.com/questions/36588354/how-to-dump-java-objects-came-from-jvm-heap-old-generation 8. http://stackoverflow.com/questions/30530082/how-can-i-restart-jvm-on-outofmemoryerror-after-making-a-heap-dump 9. http://stackoverflow.com/questions/28767905/what-is-the-difference-between-xss-and-xxthreadstacksize 10. http://stackoverflow.com/questions/25309748/what-is-thread-stack-size-option-xss-given-to-jvm-why-does-it-have-a-limit-of 11. http://stackoverflow.com/questions/35792936/how-to-take-a-heap-dump-in-windows-with-minimum-downtime 12. http://stackoverflow.com/questions/34076680/java-out-of-memory-automatic-heap-dump-file-name 13. http://stackoverflow.com/questions/26548103/how-to-obtain-the-jvm-thread-name-id-through-the-known-pid-tid 14. http://stackoverflow.com/questions/26116181/access-stacktraces-with-good-performance 15. http://stackoverflow.com/questions/23552296/how-to-determine-hotspot-vm-default-thread-stack-size 16. http://stackoverflow.com/questions/36458490/jni-how-to-list-all-the-current-instances 17. http://stackoverflow.com/questions/36279207/get-a-heap-dump-from-a-jre-only-on-windows 18. http://stackoverflow.com/questions/32605962/locate-and-read-objects-of-a-specific-type-from-memory-of-a-running-java-program 19. http://stackoverflow.com/questions/30629014/how-to-get-object-id-as-used-in-heap-dump 20. http://stackoverflow.com/questions/26502836/jmap-fforce-option-doesnt-work 21. http://stackoverflow.com/questions/25007427/how-are-exceptions-caught-and-dealt-with-at-the-low-assembly-level 22. http://stackoverflow.com/questions/23632653/generate-java-heap-dump-on-uncaught-exception 23. http://stackoverflow.com/questions/32198820/why-jstack-not-working-when-the-tmp-java-pidnum-socket-file-has-been-deleted 24. http://stackoverflow.com/questions/23247947/how-to-automatically-dump-memory-when-old-gen-of-jvm-exceeds-some-ratio
  • 3. 3 Exception traces Exception in thread "main" java.net.UnknownHostException: nonexistent.com at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at TestConnection.main(TestConnection.java:6)
  • 5. 5 No stack trace • Implicit exceptions - NullPointerException - ArrayIndexOutOfBoundsException - ArithmeticException - ArrayStoreException - ClassCastException • -XX:-OmitStackTraceInFastThrow Exception traces
  • 6. 6 Exception traces @Benchmark public Object date() { return new Date(); } @Benchmark public Object exception() { return new Exception(); } Benchmark Mode Cnt Score Error Units Exception.date avgt 10 8,457 ± 0,040 ns/op Exception.exception avgt 10 1208,841 ± 15,569 ns/op
  • 7. 7 Exception traces public Throwable() { fillInStackTrace(); } public synchronized Throwable fillInStackTrace() { if (stackTrace != null || backtrace != null) { fillInStackTrace(0); stackTrace = UNASSIGNED_STACK; } return this; } private native Throwable fillInStackTrace(int dummy);
  • 8. 8 Exception traces @Benchmark public Object exceptionNoStackTrace() { return new Exception() { @Override public Throwable fillInStackTrace() { return this; } }; } Benchmark Mode Cnt Score Error Units Exception.date avgt 10 8,457 ± 0,040 ns/op Exception.exceptionNoStackTrace avgt 10 7,839 ± 0,034 ns/op
  • 9. 9 Exception traces protected Exception(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { public class LightException extends Exception { public LightException(String message, Throwable cause) { super(message, cause, true, false); } }
  • 10. 10 Exception traces @Param({"1", "2", "10", "100", "1000"}) int depth; @Benchmark public Object throwCatch() { try { return recursive(depth); } catch (Exception e) { return e; } } private Object recursive(int depth) throws Exception { if (depth == 0) { throw new LightException(); } return recursive(depth - 1); }
  • 11. 11 Exception traces @Param({"1", "2", "10", "100", "1000"}) int depth; @Benchmark public Object throwCatch() { try { return recursive(depth); } catch (Exception e) { return e; } } private Object recursive(int depth) throws Exception { if (depth == 0) { throw new LightException(); } return recursive(depth - 1); } Benchmark (depth) Mode Cnt Score Error Units Exceptions.throwCatch 1 avgt 10 8,020 ± 0,062 ns/op Exceptions.throwCatch 2 avgt 10 126,724 ± 0,697 ns/op Exceptions.throwCatch 10 avgt 10 620,068 ± 3,354 ns/op Exceptions.throwCatch 100 avgt 10 5750,440 ± 34,838 ns/op Exceptions.throwCatch 1000 avgt 10 58465,378 ± 251,693 ns/op
  • 12. 12 Exception traces @Benchmark public Object fillInStackTrace() { return new Exception(); } @Benchmark public Object getStackTrace() { return new Exception().getStackTrace(); } Benchmark Mode Cnt Score Error Units Exceptions.fillInStackTrace avgt 10 1207,092 ± 10,150 ns/op Exceptions.getStackTrace avgt 10 13388,665 ± 54,684 ns/op
  • 13. 13 Exception traces int depth = getStackTraceDepth(); stackTrace = new StackTraceElement[depth]; for (int i = 0; i < depth; i++) stackTrace[i] = getStackTraceElement(i); native calls public final class StackTraceElement { private String declaringClass; private String methodName; private String fileName; private int lineNumber; ... }
  • 14. 14 Exception traces Exception in thread "main" java.net.UnknownHostException: nonexistent.com at java.net.PlainSocketImpl.connect(java.base@9-ea/PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(java.base@9-ea/SocksSocketImpl.java:402) at java.net.Socket.connect(java.base@9-ea/Socket.java:591) at java.net.Socket.connect(java.base@9-ea/Socket.java:540) at java.net.Socket.<init>(java.base@9-ea/Socket.java:436) at java.net.Socket.<init>(java.base@9-ea/Socket.java:213) at TestConnection.main(TestConnection.java:6) public final class StackTraceElement { private String moduleName; private String moduleVersion; private String declaringClass; private String methodName; private String fileName; private int lineNumber; new in JDK 9
  • 15. 15 Exception performance • new Exception() is cheap - fillInStackTrace() costs! - getStackTrace() costs even more! - O(stack_depth) • throw is cheap - catch ≈ goto in the same frame - O(stack_depth) Exception traces
  • 16. 16 Tips • Use -XX:-OmitStackTraceInFastThrow • No exceptions in normal control flow • But if you really want - use no-stack-trace constructor Exception traces
  • 17. When do you need stack traces?
  • 18. 18 Use cases "Thread-1" #18 prio=5 os_prio=0 tid=0x1923a800 nid=0xdf8 waiting on condition [0x19faf000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0xd94cec48> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285) at RpcTest.clientLoop(RpcTest.java:34) at java.lang.Thread.run(Thread.java:745) "Thread-2" #19 prio=5 os_prio=0 tid=0x19243800 nid=0x3d40 runnable [0x1a0af000] java.lang.Thread.State: RUNNABLE at one.nio.net.NativeSocket.readFully(Native Method) at one.nio.rpc.RpcClient.invoke(RpcClient.java:76) at RpcTest.clientLoop(RpcTest.java:36) at java.lang.Thread.run(Thread.java:745)
  • 19. 19 Use cases "Thread-1" #18 prio=5 os_prio=0 tid=0x1923a800 nid=0xdf8 waiting on condition [0x19faf000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0xd94cec48> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285) at RpcTest.clientLoop(RpcTest.java:34) at java.lang.Thread.run(Thread.java:745) Locked ownable synchronizers: - None "Thread-2" #19 prio=5 os_prio=0 tid=0x19243800 nid=0x3d40 runnable [0x1a0af000] java.lang.Thread.State: RUNNABLE at one.nio.net.NativeSocket.readFully(Native Method) at one.nio.rpc.RpcClient.invoke(RpcClient.java:76) at RpcTest.clientLoop(RpcTest.java:36) at java.lang.Thread.run(Thread.java:745) Locked ownable synchronizers: - <0xd94cec48> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) -XX:+PrintConcurrentLocks
  • 20. 20 Use cases Logging logger.warning("Operation timed out"); [Controller.java:123] WARNING: Operation timed out public static String getLocation() { StackTraceElement s = new Exception().getStackTrace()[2]; return s.getFileName() + ':' + s.getLineNumber(); }
  • 21. 21 Use cases A better way? Thread.current().getStackTrace() public StackTraceElement[] getStackTrace() { if (this != Thread.currentThread()) { // ... some magic ... } else { // Don't need JVM help for current thread return (new Exception()).getStackTrace(); } }
  • 22. 22 Use cases A better way! public static String getLocation() { StackTraceElement s = sun.misc.SharedSecrets.getJavaLangAccess() .getStackTraceElement(new Exception(), 2); return s.getFileName() + ':' + s.getLineNumber(); } Not in JDK 9
  • 23. 23 Caller sensitive methods • @CallerSensitive - Class.forName - ResourceBundle.getBundle - System.loadLibrary - AccessController.doPrivileged • sun.reflect.Reflection.getCallerClass Use cases
  • 24. 24 Stack Walking API • Limit depth • Filter frames • Lazy construction • Class instances instead of Class names Stack Walking API
  • 26. 26 java.lang.StackWalker • StackWalker.getInstance() • StackWalker.getInstance(Set<Option> options) - RETAIN_CLASS_REFERENCE - SHOW_REFLECT_FRAMES - SHOW_HIDDEN_FRAMES • StackWalker.getInstance(Set<Option> options, int estimateDepth) Stack Walking API
  • 27. 27 Stack Walking API StackWalker sw = StackWalker.getInstance(); sw.forEach(System.out::println); StackWalking.dumpStackTrace(StackWalking.java:7) StackWalking.main(StackWalking.java:12) com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  • 28. 28 Stack Walking API StackWalker sw = StackWalker.getInstance(StackWalker.Option.SHOW_REFLECT_FRAMES); sw.forEach(System.out::println); StackWalking.dumpStackTrace(StackWalking.java:7) StackWalking.main(StackWalking.java:12) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:531) com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  • 29. 29 Stack Walking API StackWalker sw = StackWalker.getInstance(StackWalker.Option.SHOW_HIDDEN_FRAMES); sw.forEach(System.out::println); StackWalking.dumpStackTrace(StackWalking.java:7) StackWalking$$Lambda$1/1287712235.run(Unknown Source bci:0) StackWalking.main(StackWalking.java:12) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:531) com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  • 30. 30 Stack Walking API public <T> T walk(Function<? super Stream<StackFrame>, ? extends T> function) public static StackFrame getCallerFrame() { return StackWalker.getInstance() .walk(stream -> stream.skip(2).findFirst()) .orElseThrow(NoSuchElementException::new); } return StackWalker.getInstance(RETAIN_CLASS_REFERENCE).getCallerClass();
  • 31. 31 Stack Walking API StackWalker sw = StackWalker.getInstance(); List<StackFrame> frames = sw.walk(stream -> stream.filter(sf -> sf.getClassName().startsWith("com.jpoint.")) .limit(10) .collect(Collectors.toList())); public Stream<StackFrame> stream(); Why NOT?
  • 32. 32
  • 33. 33 Stack size Fun with recursion static int depth; static void recursion() { depth++; recursion(); } public static void main(String[] args) { recursion(); }
  • 36. 36 Stack size • -Xss, -XX:ThreadStackSize • Thread(threadGroup, target, name, stackSize) • java.lang.OutOfMemoryError: Unable to create new native thread Stack size
  • 37. 37 Stack size • Default stack size? - x86: 320 KB - x64: 1MB • Minimum stack size? - ~228 KB Stack size frame empty shadow 1 2 frame frame
  • 39. 39 Types of profiling • Instrumentation • Sampling - Take stack traces every 10 – 100 ms - Suitable for production Profiling public void someMethod(String... args) { Profiler.onMethodEnter("myClass.someMethod"); // method body Profiler.onMethodExit("myClass.someMethod"); }
  • 41. 41 Sampling bias • Stack traces are taken at VM safepoint • Running and idle threads are sampled equally • Blocking native calls appear as Runnable • Victims: VisualVM, JProfiler, YourKit… Profiling
  • 42. 42 Fair profiler? • setitimer + SIGPROF • SIGPROF handler collects stack trace of signaled thread • HotSpot internal API: AsyncGetCallTrace - Used in Oracle Solaris Studio Profiling
  • 43. 43 Profiling AsyncGetCallTrace ASGCT_CallFrame frames[MAX_FRAMES]; ASGCT_CallTrace trace = {env, MAX_FRAMES, frames}; AsyncGetCallTrace(&trace, trace.num_frames, ucontext); from signal handler https://github.com/apangin/async-profiler
  • 45. 45 In-process • Java - Thread.getAllStackTraces - ThreadMXBean.getThreadInfo • JVMTI - GetAllStackTraces - Compact representation (jmethodID) - Used by profilers Thread dump  StackTraceElement[]
  • 46. 46 External • SIGQUIT (kill -3, Ctrl + ) - Processed by JVM at max. speed - No intermediate structures - Prints to stdout • jstack - Dynamic attach • jstack -F - Serviceability Agent Thread dump
  • 47. 47 Thread dump Dynamic attach jstack JVM 1. creates .attach_pid1234 sends SIGQUIT 2. starts AttachListener UNIX socket /tmp/.java_pid1234 verifies euid + egid 3. sends “threaddump” 4. executes command sends output back to socket
  • 48. 48 jstack • Pros. - Performed by JVM at max. speed - Compatibility with different JVM versions • Cons. - Should be run by the same user (euid / egid) - Works only on healthy JVM - Can be disabled (-XX:+DisableAttachMechanism) Thread dump
  • 49. 49 Thread dump Serviceability Agent jstack -F JVM 1. PTRACE_ATTACH the process suspends (SIGSTOP) 2. Read remote memory PTRACE_PEEKDATA 3. Reconstruct VM structures 4. Traverse reconstructed stack
  • 50. 50 jstack -F • Pros. - No cooperation from JVM required - root can dump any process - Mixed Java+Natives frames (-m) • Cons. - Slow - Requires the same version of JVM - No thread names, no lock info Thread dump
  • 51. 51 Thread dump How to dump? public static void dump() throws AttachNotSupportedException, IOException { String vmName = ManagementFactory.getRuntimeMXBean().getName(); String pid = vmName.substring(0, vmName.indexOf('@')); HotSpotVirtualMachine vm = (HotSpotVirtualMachine) VirtualMachine.attach(pid); try { vm.localDataDump(); } finally { vm.detach(); } } https://github.com/odnoklassniki/one-nio/blob/master/src/one/nio/mgt/
  • 53. 53 jmap • jmap -dump:live,format=b,file=heap.bin PID • jmap -histo PID Heap dump num #instances #bytes class name ---------------------------------------------- 1: 1943 404550984 [J 2: 5622 41517944 [B 3: 306128 33720768 [C 4: 292548 7021152 java.lang.String 5: 131072 4194304 one.nio.lock.RWLock 6: 103634 3316288 java.util.HashMap$Node 7: 89096 2138304 java.lang.Long 8: 17503 1850168 [Ljava.lang.Object; 9: 50688 1622016 [Lone.cassandra12.remoting.Host;
  • 54. 54 Heap dump jmap vs. jmap -F + Speed + Version tolerance + Supports “live” option - Requires the same user - Works only on healthy JVM + Can be used on hung process + Can be used on core dump + root can dump everything - Slow - Requires the same JDK - Heap may be inconsistent jmap jmap -F
  • 55. 55 Heap dump Offline heap dumps $ sudo gcore 1234 $ jmap -dump:format=b,file=heap.bin /path/to/java core.1234 Windows: WinDbg.exe jmap -dump:format=b,file=heap.bin C:pathtojava.exe core.mdmp
  • 56. 56 Automatic heap dumps • -XX:+HeapDumpOnOutOfMemoryError • -XX:+HeapDumpBeforeFullGC • -XX:+HeapDumpAfterFullGC • -XX:HeapDumpPath=/tmp (or /tmp/dump.bin) Heap dump
  • 57. 57 Heap dump Manageable options HotSpotDiagnosticMXBean bean = ManagementFactory.newPlatformMXBeanProxy( ManagementFactory.getPlatformMBeanServer(), "com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class); bean.setVMOption("HeapDumpOnOutOfMemoryError", "true"); bean.setVMOption("HeapDumpPath", fileName); $ jinfo -flag +HeapDumpOnOutOfMemoryError 1234 $ jinfo -flag HeapDumpPath=/tmp 1234
  • 58. 58 Kill JVM after heap dump • -XX:+ExitOnOutOfMemoryError • -XX:+CrashOnOutOfMemoryError Heap dump $ java -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError="kill -9 %p" com.jpoint.TestApp JDK 8u92
  • 60. 60 Heap dump JMX HotSpotDiagnosticMXBean bean = ManagementFactory.newPlatformMXBeanProxy( ManagementFactory.getPlatformMBeanServer(), "com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class); bean.dumpHeap("/tmp/heap.bin", true);
  • 61. 61 Heap dump JVMTI jvmtiIterationControl JNICALL HeapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) { *tag_ptr = 1; return JVMTI_ITERATION_CONTINUE; } jvmti->IterateOverInstancesOfClass(targetClass, JVMTI_HEAP_OBJECT_EITHER, HeapObjectCallback, NULL); jlong tag = 1; jint count; jobject* instances; jvmti->GetObjectsWithTags(1, &tag, &count, &instances, NULL);
  • 62. 62 Heap dump Serviceability Agent SystemDictionary dictionary = VM.getVM().getSystemDictionary(); Klass klass = dictionary.find("java/lang/String", null, null); VM.getVM().getObjectHeap().iterateObjectsOfKlass(new DefaultHeapVisitor() { public boolean doObj(Oop obj) { obj.printValue(); System.out.println(); return false; } }, klass); $JAVA_HOME/lib/sa-jdi.jar
  • 63. 63 Conclusions • Use thread dumps and heap dumps - In PROD! • In-process - Java (JMX), JVMTI • Externally - Dynamic attach - Serviceability Agent Heap dump

Hinweis der Redaktion

  1. - Кто не понимает, что здесь написано? - Вы, случаем, не на хаскеле пишете?