Skip to content

Integrate tokio-console#2008

Open
ImplOfAnImpl wants to merge 1 commit intomasterfrom
integrate_tokio_console
Open

Integrate tokio-console#2008
ImplOfAnImpl wants to merge 1 commit intomasterfrom
integrate_tokio_console

Conversation

@ImplOfAnImpl
Copy link
Contributor

tokio-console is a standalone tool that can connect to the app and show currently running tokio tasks, which can be useful for debugging.

To integrate its support in the app:

  1. tokio unstable API has to be enabled (can only be done via rustflags).
  2. a task must be spawned via the console_subscriber crate and the result added as a tracing layer.

To make the output of tokio-console understandable though, important tasks should have names, which can only be specified via unstable API. So I encapsulated tokio's task spawning functions in the corresponding functions in utils. (I also moved the existing functions from logging/src/tracing_utils.rs to utils and renamed them for consistency).

To enable tokio-console support, build the app with --features tokio-console.

Here is how node-daemon tasks look like in tokio-console:
tokio_console_output_example

P.S. sometimes you'll also see tasks like these:
tokio_console_output_example_block_in_place
They come from block_in_place calls that mempool uses to access chainstate and are the result of the call to spawn_blocking here, which block_in_place does to offload tasks from the current thread to another one.
They don't correspond to any particular task in the app and can be ignored.

@ImplOfAnImpl ImplOfAnImpl marked this pull request as draft February 4, 2026 15:50
@ImplOfAnImpl ImplOfAnImpl force-pushed the integrate_tokio_console branch from 6f6b86c to d984398 Compare February 4, 2026 17:18
@ImplOfAnImpl ImplOfAnImpl marked this pull request as ready for review February 4, 2026 18:29
Base automatically changed from fix_subsys_hanging to master February 6, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant