@@ -81,14 +81,19 @@ The metadata is not used by the agent directly, and only provided to the reporte
81
81
If you want to find long poll times, and you have ` RUSTFLAGS="--cfg tokio_unstable" ` , you can
82
82
emit ` tokio.PollCatchV1 ` events this way:
83
83
84
- ```
84
+ ``` rust
85
85
#[cfg(tokio_unstable)]
86
86
{
87
87
rt . on_before_task_poll (| _ | async_profiler_agent :: pollcatch :: before_poll_hook ())
88
88
. on_after_task_poll (| _ | async_profiler_agent :: pollcatch :: after_poll_hook ());
89
89
}
90
90
```
91
91
92
+ If you can't use ` tokio_unstable ` , it is possible to wrap your tasks by instrumentation that calls
93
+ ` before_poll_hook ` before user code runs and ` after_poll_hook ` after user code runs, but that
94
+ runs the risk of forgetting to instrument the task that is actually causing the high latency,
95
+ and therefore it is strongly recommended to use ` on_before_task_poll ` /` on_after_task_poll ` .
96
+
92
97
### Not enabling the AWS SDK / Reqwest default features
93
98
94
99
The ` aws-metadata-no-defaults ` and ` s3-no-defaults ` feature flags do not enable feature flags for the AWS SDK and ` reqwest ` .
@@ -139,6 +144,50 @@ The output should look like this
139
144
140
145
If it does not work, make sure you are using the most recent version of ` async-profiler ` and that you enabled the pollcatch hooks.
141
146
147
+ ### Missing samples
148
+
149
+ If you are missing pollcatch samples, you can also run the decoder with ` --include-non-pollcatch ` and a time
150
+ filter of 0 us to see all samples, as in:
151
+
152
+ ```
153
+ ./decoder/target/release/pollcatch-decoder longpolls --include-non-pollcatch --zip profile_WHATEVER_*.zip
154
+ ```
155
+
156
+ #### Samples are still not showing
157
+
158
+ If the samples are still missing, this is probably a problem with async-profiler or its use. Make sure you are using
159
+ async-profiler correctly.
160
+
161
+ #### Sample found with "sample with no pollcatch information"
162
+
163
+ If this discovers the samples as "sample with no pollcatch information", for example:
164
+
165
+ ```
166
+ [87.831540] thread 1878 - sample with no pollcatch information
167
+ - 1: libc.so.6.clock_nanosleep
168
+ - 52 more frame(s) (pass --stack-depth=53 to show)
169
+ ```
170
+
171
+ It is likely that you do not have pollcatch enabled correctly. Make sure you are using the [ ` before_poll_hook `
172
+ and ` after_poll_hook ` hooks] [ pollcatch ] , which normally requires using ` --cfg tokio_unstable ` . Also make sure that
173
+ you are using async-profiler that supports user events (` v4.0 ` or higher, if you are using official versions
174
+ from upstream).
175
+
176
+ [ pollcatch ] : #pollcatch
177
+
178
+ ### Dealing with ` unknown ` frames / truncated stack traces
179
+
180
+ If you are seeing ` unknown ` frames, this indicates that ` async-profiler ` has problems finding unwinding
181
+ information. There are 2 normal causes for that:
182
+
183
+ 1 . Your code, or the code of some library you are using, is missing debuginfo. To fix that, compile your
184
+ code with ` debuginfo ` or at least ` debuginfo-lines ` .
185
+ 2 . The running stack frame contains code that is generated by a JIT. Current versions of ` async-profiler `
186
+ support unwinding JVM frames, but frames generated by other JITs will show up as ` unknown ` .
187
+
188
+ ` async-profiler ` is often not capable of unwinding past ` unknown ` frames, so they will often "truncate"
189
+ the stack trace which will not go past one or two ` unknown ` frames.
190
+
142
191
[ `jfrs` ] : https://docs.rs/jfrs
143
192
144
193
## Security
@@ -147,4 +196,4 @@ See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more inform
147
196
148
197
## License
149
198
150
- This project is licensed under the Apache-2.0 License.
199
+ This project is licensed under the Apache-2.0 License.
0 commit comments