explaingit

tokio-rs/console

4,517RustAudience · developerComplexity · 3/5Setup · moderate

TLDR

A live debugger for async Rust programs that shows you every background task in real time, like the 'top' command but for Tokio tasks instead of OS processes.

Mindmap

mindmap
  root((tokio-console))
    How It Works
      Wire protocol
      gRPC streaming
      Protocol buffers
    Setup
      Add console-subscriber
      Enable tokio_unstable flag
      Run console tool
    Live Task View
      Task list display
      Poll counts
      Idle vs active state
    Under The Hood
      Tokio async runtime
      Tracing library
      Localhost port 6669
    Use Cases
      Debug stuck tasks
      Find slow tasks
      Inspect task lifetime
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Find out why an async task in your Rust program is stuck or never finishing

USE CASE 2

See how many times each task is being polled to spot performance bottlenecks

USE CASE 3

Get a live dashboard of all running tasks without adding complex logging

USE CASE 4

Debug async programs that are hard to inspect with traditional debuggers

Tech stack

RustTokiogRPCProtocol Bufferstracingconsole-subscriber

Getting it running

Difficulty · moderate Time to first run · 30min

Add console-subscriber to Cargo.toml, call the setup function in main, and build with RUSTFLAGS='--cfg tokio_unstable'. Then run the tokio-console binary separately.

No license was mentioned in the explanation.

In plain English

tokio-console is a debugging tool for asynchronous Rust programs. Asynchronous programs run many tasks at once, and when something goes wrong, such as a task getting stuck or running too slow, traditional debuggers do not surface the problem well. This tool gives you a live, interactive view of what those tasks are doing as your program runs. The project has three parts that work together. First, there is a wire protocol: a defined format for streaming diagnostic data from a running program to an external viewer. Second, there is a library called console-subscriber that you add to your Rust project, which collects task data and sends it out over that wire format. Third, there is the tokio-console command-line tool itself, which connects to that data stream and shows a real-time task list, similar to how the top command shows OS processes. Getting started takes two steps. You add console-subscriber as a dependency and call one function at the top of your main function. You also need to build your program with a specific compiler flag called tokio_unstable, because the underlying task data comes from an experimental part of the Tokio async runtime. After that, you run the console tool separately, and it connects to your program on localhost port 6669 by default. A different address can be passed as an argument if your program runs elsewhere. The interactive terminal display shows tasks currently running in your program, with information like how long each task has been alive, how many times it has been polled by the runtime, and whether it is idle or active. Selecting a task shows additional detail. This kind of visibility into async behavior is otherwise difficult to get from standard tools. The project builds on Tokio, the most widely used async runtime for Rust, and uses the tracing library for instrumentation. The wire protocol uses gRPC and protocol buffers. The README notes this work builds on a 2019 prototype and on broader community efforts to improve async debugging in Rust.

Copy-paste prompts

Prompt 1
I'm adding tokio-console to my Rust project. Show me the exact Cargo.toml changes and the one-line setup call I need in my main function to enable console-subscriber.
Prompt 2
My async Rust program has a task that seems stuck. I have tokio-console running. Walk me through what to look for in the task list to identify the problem.
Prompt 3
Explain how to build my Rust project with the tokio_unstable compiler flag so tokio-console can access task data, including how to set it in .cargo/config.toml.
Prompt 4
I want to run my Rust program on a remote server and connect tokio-console from my laptop. How do I change the default localhost:6669 address?
Prompt 5
What does the poll count shown in tokio-console actually mean, and what does a very high or very low poll count tell me about a task's behavior?
Open on GitHub → Explain another repo

← tokio-rs on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.