tokio-troubleshooting

Diagnose deadlocks, leaks, and performance issues in Tokio runtimes.

8|2|Updated Oct 17, 2025
One-click install
npx skills add https://github.com/geoffjay/claude-plugins --skill tokio-troubleshooting
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tokio-troubleshooting
Source: https://github.com/geoffjay/claude-plugins/tree/main/plugins/rust-tokio-expert/skills/tokio-troubleshooting
Command: npx skills add https://github.com/geoffjay/claude-plugins --skill tokio-troubleshooting

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Debugging and troubleshooting asynchronous applications built with Tokio can be complex, especially when diagnosing runtime issues, deadlocks, memory leaks, or performance bottlenecks. This Skill provides structured guidance and best practices to observe, reason about, and resolve common Tokio runtime problems.

Core Features & Use Cases

  • Realtime runtime inspection: Use tokio-console to observe task spawn rates, poll durations, and resource usage.
  • Deadlock and hang debugging: Identify and resolve common async deadlock patterns and hangs.
  • Memory leak detection: Spot task leaks, improper shutdowns, and cyclic references in async code.
  • Performance profiling: Analyze task metrics to optimize scheduling and reduce jitter.

Quick Start

To begin, enable tokio-console in your Rust project and attach to the running application:

  • Add console-subscriber = "0.2" to Cargo.toml.
  • Initialize the subscriber at startup with console_subscriber::init(); before constructing the Tokio runtime.
  • Run the application and observe the metrics in the tokio-console UI in a separate terminal.

Frequently Asked Questions about tokio-troubleshooting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug deadlocks and hangs in my Tokio async application?

Deadlocks in Tokio occur when tasks wait on each other indefinitely or hold locks across await points. Use tokio-console to observe task states and poll durations, then refactor to avoid lock-holding across awaits and ensure proper task cancellation on shutdown.

What is tokio-console and how do I use it to monitor my Rust async runtime?

tokio-console is a real-time debugging tool that displays task metrics, spawn rates, and resource usage for Tokio applications. Add console-subscriber to Cargo.toml, initialize it before the runtime, then connect the UI to observe live metrics and identify bottlenecks.

How do I detect and fix memory leaks in Tokio applications?

Memory leaks in async code stem from task leaks, improper shutdowns, or cyclic references. Use tokio-console to track task counts and tracing to log resource allocation, then audit drop implementations and ensure graceful shutdown closes all spawned tasks.

Can I use tokio-console with multi-threaded Tokio workloads?

Yes, tokio-console works with multi-threaded Tokio runtimes and displays metrics across all worker threads. It captures task scheduling, contention, and runtime behavior across the entire thread pool, enabling diagnosis of cross-thread performance issues.

What's the best way to profile and optimize Tokio task performance?

Profile using tokio-console to measure task poll durations and scheduling latency across your runtime. Identify high-poll-duration tasks, reduce blocking work in async contexts, and tune the thread pool size to minimize jitter and contention.

Do I need to modify my application code to use tokio-console for debugging?

Minimal changes are required: add console-subscriber as a dependency and call console_subscriber::init() at startup before constructing the runtime. No core business logic changes are needed; the subscriber runs in the background.