-
Notifications
You must be signed in to change notification settings - Fork 148
Keep tokio console only in the playground #3950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses a memory leak issue caused by tokio_unstable by removing it from the global build configuration and restricting tokio-console support to the playground environment only. The changes introduce a feature flag approach that allows tokio-console to be enabled on-demand rather than globally.
- Removed global
tokio_unstableconfiguration from.cargo/config.toml - Converted
console-subscriberto an optional dependency gated behind atokio-consolefeature flag - Updated playground Dockerfile to explicitly enable tokio-console feature for all packages
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.cargo/config.toml |
Removed global tokio_unstable rustflag configuration to prevent memory leaks in production |
crates/observe/Cargo.toml |
Made console-subscriber optional and added tokio-console feature flag |
crates/observe/build.rs |
Added clarifying comments about tokio_unstable usage in playground |
crates/observe/src/tracing.rs |
Refactored tokio-console initialization to use conditional compilation with both tokio_unstable cfg and tokio-console feature flag |
playground/Dockerfile |
Added --features observe/tokio-console to all cargo build commands to enable tokio-console in playground environment |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let enable_tokio_console: bool = std::env::var("TOKIO_CONSOLE") | ||
| .unwrap_or("false".to_string()) | ||
| .parse() | ||
| .unwrap(); |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .unwrap() call could panic if the TOKIO_CONSOLE environment variable is set to an invalid value (e.g., "maybe", "1", "yes"). Consider using .unwrap_or(false) or .unwrap_or_else(|_| false) to handle parsing errors gracefully, defaulting to false when the value cannot be parsed as a boolean.
| .unwrap(); | |
| .unwrap_or(false); |
Description
It turned out that
tokio_unstableintroduces a memory leak when creating spans. As @MartinquaXD noticed:Disabling the
tokio_unstablehelped to mitigate the memory leak issue almost completely.Changes
tokio_unstablefrom the codebase.Further implementation
Using the updated deployment CI job from #3954, the tokio-console can be gated behind a feature in case we need to run it in the future. Will implement it in a follow-up pr.