Comments (10)
In this particular case it seems to be a "sibling" method that is actually doing the allocations:
Counter: 9428816 (97.81%)
[ 0] [Ljava/lang/Object;
[ 1] akka.http.scaladsl.model.Uri$.create
[ 2] akka.http.impl.model.parser.UriParser.parseHttpRequestTarget
[ 3] akka.http.scaladsl.model.Uri$.parseHttpRequestTarget
[ 4] akka.http.impl.engine.parsing.HttpRequestParser$$anon$1.parseRequestTarget
[ 5] akka.http.impl.engine.parsing.HttpRequestParser$$anon$1.parseMessage
[ 6] akka.http.impl.engine.parsing.HttpMessageParser$class.startNewMessage
[ 7] akka.http.impl.engine.parsing.HttpRequestParser$$anon$1.startNewMessage
[ 8] akka.http.impl.engine.parsing.HttpMessageParser$$anonfun$startNewMessage$1.apply
Using VisualVM I found out that it's not create
but another call chain starting from UriParser.parseHttpRequestTarget
which is actually doing the allocations.
from async-profiler.
This might be a bug of AsyncGetCallTrace. Does -XX:+DebugNonSafepoints
make it better?
Do you have a small reproducer that you can share?
from async-profiler.
I've also run into seemingly impossible stack traces when CPU profiling the Scala compiler with flight recorder or async-profiler. For a while, I thought I was going crazy! It's comforting to know that the flaw might be elsewhere.
I've just trawled some open bugs on AsyncGetCallTrace
. JDK-8022893 is a good one with a reproduction and has analysis of the root cause in the comments. It is plausibly the same problem as reported here.
from async-profiler.
@apangin in my case with -XX:+DebugNonSafepoints
it is missing intermediate frames:
[ 0] [Ljava/lang/Object;
[ 1] akka.http.impl.engine.parsing.HttpRequestParser$$anon$1.parseRequestTarget
[ 2] akka.http.impl.engine.parsing.HttpRequestParser$$anon$1.parseMessage
[ 3] akka.http.impl.engine.parsing.HttpMessageParser$class.startNewMessage
[ 4] akka.http.impl.engine.parsing.HttpRequestParser$$anon$1.startNewMessage
[ 5] akka.http.impl.engine.parsing.HttpMessageParser$$anonfun$startNewMessage$1.apply
[ 6] akka.http.impl.engine.parsing.HttpMessageParser$$anonfun$startNewMessage$1.apply
[ 7] akka.http.impl.engine.parsing.HttpMessageParser$$anonfun$continue$2.apply
[ 8] akka.http.impl.engine.parsing.HttpMessageParser$$anonfun$continue$2.apply
[ 9] akka.http.impl.engine.parsing.HttpMessageParser$class.run$1
while it should have three more frames on top of HttpRequestParser$$anon$1.parseRequestTarget
.
I don't have a small reproducer right now, I guess I could build a bigger one sharing a ~30MB jar file and instructions.
from async-profiler.
OK, looks like I can reproduce the problem. Will investigate this.
from async-profiler.
After some investigation I can confirm that it is AsyncGetCallTraces that works wrong.
If I replace AGCT with the standard JVM TI GetStackTrace call, everything looks good. Fortunately, it is safe to do so for allocation profiler (but not for CPU profiler).
I think the right fix would be to check if current thread has _last_Java_sp set, and, if yes, call JVM TI GetStackTrace(), otherwise call AsyncGetCallTrace.
from async-profiler.
Might make sense to compare results with the output generated by grav: https://epickrram.blogspot.de/2017/09/heap-allocation-flamegraphs.html
from async-profiler.
Re-implemented Java stack traces with JVM TI for allocation profiling. This is going to be accurate now.
from async-profiler.
Unfortunately, calling JVM TI from VM context may sometimes trigger assertion in VM code (#64), so reverted back to AsyncGetCallTrace for now. Better inaccurate than unsafe.
Will fix that properly in #66.
from async-profiler.
Re-implemented allocation stack walking once again. Now the stacks should be accurate without a risk of internal JVM deadlocks or assertion failures.
from async-profiler.
Related Issues (20)
- java.lang.NoSuchMethodError when calling jfr2flame with jdk 8 HOT 1
- `timeout` in native mode does not work HOT 2
- Segfault on start when native mode profiling HOT 3
- The Java wrapper is unable to collect data from Java_sun_nio_ch_IOUtil_makePipe HOT 2
- Crash inside ElfParser::ElfParser HOT 1
- Async Profiler and Java Flight Recorder are missing some methods at the bottom of the stack. HOT 16
- build failed. HOT 4
- Dear Andrei, when will we release 2.10? HOT 8
- Running jfr2flame on concatenated JFR files produces nonsense stacktraces HOT 4
- is https://github.com/async-profiler/async-profiler/issues/154 already fixed in latest async profiler? HOT 3
- Thread filter in wallclock HOT 3
- `unknown_Java` during profiling on M1 macbook HOT 3
- Target application crashes during profiling on M1 macbook HOT 5
- async-profiler can't find process by name when CPU is overloaded HOT 3
- Accurate CPU sampling without perf_events HOT 1
- [JDK22] `jfr2flame` errors out with `Invalid string encoding` when converting to flame graph HOT 3
- How can I get time in flamegraph? HOT 1
- is it possible to get class imported jar version? HOT 1
- Crash in WallClock::getThreadState HOT 15
- asprof to run jattach commands
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from async-profiler.