Skip to content

Conversation

@kixelated
Copy link
Collaborator

Summary

  • Add tokio-console feature for async task debugging
  • Add parking_lot deadlock detector (debug builds only)
  • Improve logging configuration with layered tracing subscriber

Details

tokio-console Support

  • Opt-in feature flag: --features moq-native/tokio-console
  • Spawns console-subscriber layer when enabled
  • No impact on default builds

Deadlock Detection

  • Automatically enabled in debug builds via cfg(debug_assertions)
  • Uses parking_lot's deadlock detector
  • Checks for deadlocks every 1 second
  • Logs detailed information with thread IDs and backtraces
  • Zero overhead in release builds

Logging Improvements

  • Migrated to layered tracing subscriber architecture
  • Added log directives for tokio and runtime crates
  • Maintains backwards compatibility

Test Plan

  • Verify compilation without features: cargo check --workspace
  • Verify compilation with tokio-console: cargo check --workspace --features moq-native/tokio-console
  • Verify deadlock detector compiles in debug mode
  • Confirm no impact on release builds

🤖 Generated with Claude Code

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 27, 2025

Warning

Rate limit exceeded

@kixelated has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 14 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 576d3f1 and 0b1a38a.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • justfile
  • rs/moq-native/src/log.rs

Walkthrough

Removed the container property from audio and video codec entries in the TypeScript broadcast config. Refactored Rust logging to use tracing_subscriber layers, added optional tokio-console integration controlled by a feature, and added a debug-only parking_lot deadlock detector thread. Cargo metadata and .cargo/config.toml were updated to enable the tokio-console feature and a tokio-related cfg flag. The justfile was updated to set TOKIO_CONSOLE_BIND for relay and publisher targets, added relay-console and pub-console targets, and the web target now runs from js/hang-demo.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add debug features to moq-native' accurately captures the main objective: introducing debugging features (tokio-console and deadlock detection) to the moq-native crate.
Description check ✅ Passed The description comprehensively covers all major changes in the PR, including tokio-console support, deadlock detection, and logging improvements, with clear details and test verification.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
rs/moq-native/src/log.rs (1)

60-83: Approve deadlock detection implementation with optional clarity improvement.

The debug-only deadlock detector is well-implemented: properly scoped to debug builds, provides detailed logging, and uses appropriate polling interval.

💡 Optional: Clarify the commented abort suggestion

The commented std::process::abort() could benefit from additional context about when developers should uncomment it:

-						// Optionally: std::process::abort() to get a core dump
+						// Uncomment to abort and generate a core dump for post-mortem analysis:
+						// std::process::abort();
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6064eb0 and 77ca6dd.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • js/hang/src/publish/element.ts
  • rs/moq-native/Cargo.toml
  • rs/moq-native/src/log.rs
💤 Files with no reviewable changes (1)
  • js/hang/src/publish/element.ts
🧰 Additional context used
📓 Path-based instructions (2)
rs/**/Cargo.toml

📄 CodeRabbit inference engine (CLAUDE.md)

For Rust development, use the workspace configuration in rs/Cargo.toml

Files:

  • rs/moq-native/Cargo.toml
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

In Rust crates, tests should be integrated within source files using inline test modules

Files:

  • rs/moq-native/src/log.rs
🧠 Learnings (1)
📚 Learning: 2025-12-10T04:00:14.871Z
Learnt from: CR
Repo: moq-dev/moq PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T04:00:14.871Z
Learning: Applies to rs/**/Cargo.toml : For Rust development, use the workspace configuration in `rs/Cargo.toml`

Applied to files:

  • rs/moq-native/Cargo.toml
🔇 Additional comments (6)
rs/moq-native/Cargo.toml (3)

18-18: LGTM! Feature flag properly configured.

The tokio-console feature correctly uses the dep: prefix to enable the optional console-subscriber dependency.


23-23: Version 0.5 is already the latest release of console-subscriber (0.5.0, published October 2025) with no known security vulnerabilities. No action required.


28-28: No action required. Version 0.12 is the current stable release of parking_lot, and there are no known vulnerabilities. The transitive dependency lock_api is at version 0.4.14, which is well above the security fix threshold (0.4.2) for historical CVEs.

Likely an incorrect or invalid review comment.

rs/moq-native/src/log.rs (3)

5-8: LGTM! Imports correctly support layered subscriber architecture.

The new imports enable the composable layer pattern for combining fmt and console subscribers.


38-40: LGTM! Enhanced log directives improve runtime observability.

The additional directives for tokio and runtime crates provide useful debugging information while maintaining appropriate log levels.


42-58: LGTM! Layered subscriber architecture properly implemented.

The conditional compilation correctly enables console-subscriber only when the feature is active, while maintaining backwards compatibility with the standard fmt layer.

- Add tokio-console feature for async task debugging
  - Compile with --features moq-native/tokio-console to enable
  - Spawns console-subscriber layer when feature is enabled
  - Add .cargo/config.toml with tokio_unstable flag for console support
  - Add justfile commands: relay-console and pub-console

- Add parking_lot deadlock detector
  - Runs automatically in debug builds (cfg(debug_assertions))
  - Checks for deadlocks every 1 second
  - Logs detailed deadlock information with backtraces

- Improve logging configuration
  - Add tokio and runtime log directives
  - Migrate to layered tracing subscriber architecture

- Update justfile for easier tokio-console usage
  - relay and pub commands set TOKIO_CONSOLE_BIND environment variable
  - Simplified web command to run only hang-demo
  - New relay-console and pub-console commands to connect tokio-console

These features are disabled by default and have no impact on release builds or runtime performance unless explicitly enabled.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@kixelated kixelated force-pushed the moq-native-debug-features branch 2 times, most recently from 2c21704 to 66290c4 Compare December 27, 2025 10:51
@kixelated kixelated force-pushed the moq-native-debug-features branch from 66290c4 to b56ea93 Compare December 27, 2025 10:53
@kixelated kixelated enabled auto-merge (squash) December 27, 2025 10:55
@kixelated kixelated merged commit bca027a into main Dec 27, 2025
1 check passed
@kixelated kixelated deleted the moq-native-debug-features branch December 27, 2025 11:03
@moq-bot moq-bot bot mentioned this pull request Dec 24, 2025
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.

2 participants