Is a large volume of resources normal when viewed in tokio-console
?
#438
Replies: 2 comments 2 replies
-
By the look of your console output, all but one of the resources on the screen have terminated (they're grayed out). This is normal, sleep resources are not "reused", each time you call sleep, a new resource is created. The terminated resources you see are kept in the console for some time so you can still see them (6 seconds by default). |
Beta Was this translation helpful? Give feedback.
-
@hds hey, thanks for the response! I actually do think these sleep calls are supposed to be completed, but they aren't going away. I took two screenshots of sleep resource details: some have async ops and others do not, and they're mixed throughout. DetailsIs the total not the number reflected next to resources? If so, where can I find the total? In the first screenshot I showed, you can see over 200k resource total in parentheses. I also recorded a video of the console running for 1 hour where it has reached 40k, but interestingly if you close and reopen the console then it drops to 17k and starts climbing again. Only for some of the details do I see busy & idle whereas others I see nothing. There's absolutely some logic error I have somewhere causing the server to hang, so not denying that! :) Was trying to use tracing to figure out where it was locking up, but the large volume of sleep resources taking over makes it difficult to figure things out. Quirk where it works? (Macbook Pro M1)This issue is showing up on my Macbook Air M1 running MacOS 12.6 and compiled with Rustc 1.69.0. When I built and tested this on a Macbook Pro M1 running MacOS 13.3.1 and compiled with Rustc 1.70.0, it actually looks like the sleep resource isn't shooting up like crazy. However, if you look closely, you can see sleeps are still persisting in the mailbox.rs. These sleeps are 100ms or less, so they shouldn't be persisting past ~6 seconds! tokio-console-pro-m1.mp4Screenshots of resource view (Macbook Air M1)Screenshots of task view (Macbook Air M1)Video of resources (Macbook Air M1)tokio-console.mp4Video of tasks & resources (Macbook Air M1)tokio-console-2.mp4 |
Beta Was this translation helpful? Give feedback.
-
I have multiple long-lived server processes that leverage tokio for async operations. They make regular use of
tokio::time::sleep
, and I've recently encountered moments where the server hangs. I'm trying to diagnose the problem and tried leveraging tokio-rs/tracing to identify bottlenecks or other issues.A couple of the frequently-displayed timer resources are sleep-based timeouts and pauses between loops.
Using sleep to avoid CPU throttling
Using sleep in a
tokio::select!
while waiting on a TCP connectionBeta Was this translation helpful? Give feedback.
All reactions