Troubleshooting
Common issues and solutions when using async-inspect.
Installation Issues
cargo install async-inspect fails
Problem: Build fails with compiler errors.
Solution:
-
Update Rust to latest stable:
rustup update stable -
Ensure minimum Rust version (1.70+):
rustc --version -
If issues persist, try clean install:
cargo install async-inspect --force
Feature compilation errors
Problem: Specific features fail to compile.
Solution:
Check feature dependencies:
# Install with specific features
cargo install async-inspect --features cli,tokio
# Or use --all-features
cargo install async-inspect --all-features
Runtime Issues
No tasks appear in monitoring
Problem: Running async-inspect monitor shows no tasks.
Checklist:
-
✅ Add tracing annotations:
#[async_inspect::trace] // ← Add this!
async fn my_function() { } -
✅ Initialize inspector:
use async_inspect::Inspector;
#[tokio::main]
async fn main() {
let inspector = Inspector::new(Default::default());
// Your code
} -
✅ Actually run async code:
// This creates future but doesn't execute!
my_function();
// This executes
my_function().await; -
✅ Check sampling rate:
Config {
sampling_rate: 1.0, // 100% in development
..Default::default()
}
Tasks not updating
Problem: Task list is stale or frozen.
Solutions:
-
Check refresh interval:
async-inspect monitor --refresh 100 # Update every 100ms -
Verify inspector is running:
println!("Task count: {}", inspector.task_count()); -
Check for panics in traced functions
CLI hangs or freezes
Problem: CLI becomes unresponsive.
Solutions:
-
Kill and restart:
pkill async-inspect
async-inspect monitor -
Check for deadlocks in your code:
async-inspect analyze --deadlocks -
Reduce refresh rate:
async-inspect monitor --refresh 1000 # Every 1 second
TUI Issues
Colors not displaying
Problem: TUI shows garbled text or no colors.
Solutions:
-
Check terminal support:
echo $TERM # Should be xterm-256color or similar -
Force color mode:
COLORTERM=truecolor async-inspect tui -
Try alternative terminal:
- iTerm2 (macOS)
- Windows Terminal (Windows)
- Alacritty (cross-platform)
TUI crashes on resize
Problem: Terminal crashes when resized.
Solution:
This is a known issue. Workaround:
# Restart TUI
async-inspect tui
Fix coming in next release.
Keyboard shortcuts not working
Problem: TUI doesn't respond to key presses.
Checklist:
- ✅ Focus is on TUI window
- ✅ Not using SSH (some keys don't forward)
- ✅ Try alternative keys:
qorCtrl+Cto quit↑↓orjkfor navigationrorF5to refresh
Performance Issues
High memory usage
Problem: async-inspect consuming too much memory.
Solutions:
-
Set memory limits:
Config {
max_tasks: 1_000, // Reduce from default 10k
max_events: 10_000, // Reduce from default 100k
..Default::default()
} -
Enable cleanup:
Config {
cleanup_interval: Duration::from_secs(30),
task_retention: Duration::from_secs(60),
..Default::default()
} -
Use sampling in production:
Config {
sampling_rate: 0.01, // Only track 1%
..Default::default()
}
High CPU usage
Problem: Performance overhead too high.
Solutions:
-
Disable expensive features:
Config {
capture_backtraces: false,
track_allocations: false,
..Default::default()
} -
Increase intervals:
async-inspect monitor --refresh 2000 # 2 seconds -
Use production mode:
Config {
mode: Mode::Production,
..Default::default()
}
Application slowdown
Problem: App runs slower with tracing enabled.
Benchmarks:
| Configuration | Overhead |
|---|---|
| No tracing | 0% |
| Development mode (100% sampling) | 5-15% |
| Analysis mode (10% sampling) | 2-5% |
| Production mode (1% sampling) | <1% |
Solutions:
-
Use conditional compilation:
#[cfg_attr(feature = "inspect", async_inspect::trace)]
async fn hot_path() { } -
Selective tracing:
// Only trace important functions
#[async_inspect::trace]
async fn api_endpoint() { }
// Don't trace tight loops
async fn background_worker() {
// No annotation
}
Export Issues
JSON export incomplete
Problem: Exported JSON missing tasks.
Causes:
-
Tasks cleaned up: Increase retention
Config {
task_retention: Duration::from_secs(3600), // 1 hour
..Default::default()
} -
Sampling active: Some tasks not tracked
Config {
sampling_rate: 1.0, // Disable sampling for export
..Default::default()
}
CSV export fails
Problem: async-inspect export --csv errors.
Solutions:
-
Check file permissions:
touch test.csv # Can we write here? -
Use absolute path:
async-inspect export --csv /tmp/export.csv -
Check disk space:
df -h .
Integration Issues
Prometheus metrics not showing
Problem: Metrics endpoint returns empty.
Checklist:
-
✅ Feature enabled:
[dependencies]
async-inspect = { version = "0.1", features = ["prometheus-export"] } -
✅ Exporter started:
let exporter = PrometheusExporter::new(inspector.clone());
exporter.start_server("0.0.0.0:9090").await?; -
✅ Port accessible:
curl http://localhost:9090/metrics -
✅ Tasks exist:
# Should show async_inspect_tasks_total
curl http://localhost:9090/metrics | grep async_inspect
OpenTelemetry not exporting
Problem: No traces in OpenTelemetry backend.
Solutions:
-
Verify endpoint:
curl http://localhost:4317 # Should connect -
Check configuration:
OtelExporter::new(
inspector.clone(),
"http://localhost:4317", // Correct endpoint?
)?; -
Enable debug logging:
RUST_LOG=async_inspect=debug cargo run
Tracing subscriber conflicts
Problem: Multiple subscriber initialization errors.
Solution:
Only initialize once:
use tracing_subscriber::prelude::*;
tracing_subscriber::registry()
.with(async_inspect::integrations::AsyncInspectLayer::new(inspector.clone()))
.with(tracing_subscriber::fmt::layer())
.init(); // ← Only call once!
VS Code Extension Issues
Extension not loading
Problem: async-inspect extension doesn't appear.
Solutions:
-
Check installation:
code --list-extensions | grep async-inspect -
Reinstall:
code --uninstall-extension async-inspect
code --install-extension async-inspect -
Check VS Code version: Requires VS Code 1.85.0 or higher
No tasks in sidebar
Problem: Sidebar shows "No tasks".
Checklist:
- ✅ Monitoring started: Click "Start Monitoring" button
- ✅ Rust workspace open: Extension only activates in Rust projects
- ✅ async-inspect CLI installed:
async-inspect --version - ✅ Code running: Tasks only appear during execution
CodeLens not showing
Problem: No inline performance stats.
Solutions:
-
Enable in settings:
{
"async-inspect.showInlineStats": true
} -
Check file type: Only works in
.rsfiles -
Restart extension:
- Cmd+Shift+P → "Reload Window"
Compilation Errors
async_inspect::trace macro not found
Problem: #[async_inspect::trace] causes compile error.
Solution:
Add dependency:
[dependencies]
async-inspect = "0.1"
async-inspect-macros = "0.1" # ← Add this
Or use feature:
[dependencies]
async-inspect = { version = "0.1", features = ["macros"] }
Lifetime errors with traced functions
Problem: Borrow checker errors after adding #[trace].
Example:
#[async_inspect::trace]
async fn process(data: &str) -> String {
data.to_string()
}
// ERROR: lifetime may not live long enough
Solution:
Add explicit lifetimes:
#[async_inspect::trace]
async fn process<'a>(data: &'a str) -> String {
data.to_string()
}
Send trait not satisfied
Problem: "future cannot be sent between threads safely".
Cause: Non-Send types held across .await points.
Solution:
-
Identify the problem using async-inspect:
async-inspect analyze --check-send -
Fix by scoping:
// ❌ BAD
async fn bad() {
let rc = Rc::new(42); // Not Send!
other_async().await; // ERROR
}
// ✅ GOOD
async fn good() {
let value = {
let rc = Rc::new(42);
*rc // Drop Rc before .await
};
other_async().await; // OK
}
Debug Logging
Enable verbose logging to diagnose issues:
# Linux/macOS
RUST_LOG=async_inspect=trace cargo run
# Windows
set RUST_LOG=async_inspect=trace
cargo run
Log levels:
error: Critical issues onlywarn: Warnings and errorsinfo: General informationdebug: Detailed debuggingtrace: Very verbose (everything)
Getting Help
If your issue isn't covered here:
- Check GitHub Issues: async-inspect/issues
- Ask in Discussions: async-inspect/discussions
- Provide details:
- OS and version
- Rust version (
rustc --version) - async-inspect version (
async-inspect --version) - Minimal reproduction code
- Full error message
Common Error Messages
"inspector not initialized"
Cause: Trying to use tracing before creating Inspector.
Fix:
let inspector = Inspector::new(Default::default());
// Now tracing will work
"failed to spawn process"
Cause: CLI not found or not executable.
Fix:
which async-inspect # Should show path
chmod +x $(which async-inspect) # Make executable
"address already in use"
Cause: Metrics/export port already taken.
Fix:
// Change port
exporter.start_server("0.0.0.0:9091").await?; // Not 9090
Performance Tuning
For production deployments, see Production Guide.
Still Having Issues?
Create a detailed bug report:
# Generate diagnostic report
async-inspect diagnostic > report.txt
# Attach to GitHub issue