Skip to content

fix(moq-relay): build the io_uring runtime only where io-uring has bindings - #8968

Merged
kixelated merged 3 commits into
mainfrom
fix/relay-uring-arch
Nov 17, 2026
Merged

kixelated merged 3 commits into
mainfrom
fix/relay-uring-arch

Conversation

@kixelated

@kixelated kixelated commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Nightly's moq-cli / release / Build (armv7-unknown-linux-gnueabihf) fails (job): io-uring's compile_error! refuses its prebuilt sys.rs on 32-bit ARM. moq-relay now always depends on moq-uring on Linux, and moq-cli embeds the relay, so every Linux target compiles io-uring, including ones it ships no bindings for. cargo install moq-relay or moq-cli on a Raspberry Pi running 32-bit Linux (armhf, a documented platform) breaks the same way, so a repo-local .cargo/config.toml cfg would only fix our release job.

Approach

moq-relay builds its io_uring runtime only where io-uring has bindings: Linux on x86_64, aarch64, riscv64, loongarch64, or powerpc64.

  • The moq-uring and web-transport-proto dependencies move under that target cfg.
  • A new build.rs sets cfg(uring) for the same targets. The relay's io_uring sites in relay.rs, internal.rs, incoming.rs, lib.rs, and auth.rs move from target_os = "linux" to uring. The handoff code stays Linux-wide.
  • The test side follows (Pullfrog): the moq-uring dev-dependency moves to a table gated on the same architectures (socket2 stays Linux-wide), and the io_uring-only integration tests (runtime_uring.rs, bitrate_caps.rs, and the io_uring cases in embed, handoff, peer_limits, refusals, tenant_matrix, wire_stats) switch from target_os = "linux" to uring, which the build script also sets for integration tests. Handoff and Tokio-worker tests stay Linux-wide. nix/Cargo.nix regenerated.
  • Elsewhere, runtime.io_uring = true refuses at config check and names the supported architectures, as it already did off Linux.

Validation

  • Reproduced the failure locally: cargo check --target armv7-unknown-linux-gnueabihf -p moq-uring hits the same compile_error!.
  • With this change, cargo check --target armv7-unknown-linux-gnueabihf -p moq-relay -p moq-cli --features moq-cli/v4l2 (the release job's crate and features) passes with -D warnings, and cargo tree -i io-uring for that target is empty.
  • Test build on armv7 (rust 1.98.1 with the armv7 std and an armv7 cross gcc from the flake's pinned nixpkgs): cargo check --target armv7-unknown-linux-gnueabihf -p moq-relay --all-targets with -D warnings passes, with and without --features test-support. Before the test-side change, the same command fails on io-uring's compile_error!. cargo tree --target armv7-unknown-linux-gnueabihf -p moq-relay -e normal,dev,build -i io-uring is empty.
  • just check passes on x86_64 Linux, where every io_uring integration test still builds and runs.
  • cargo clippy -p moq-relay --all-targets -D warnings passes on x86_64 Linux, with and without test-support.

Impact

Alternatives

  • Pass --cfg io_uring_skip_arch_check for armv7. The skip is sound there: bindgen output for armv7 from the kernel headers is byte-identical to x86_64 and aarch64, including layout assertions and syscall numbers (425–427 on ARM EABI too). It would keep io_uring on armv7, but a repo-local cfg can't reach cargo install users, and io_uring on a 32-bit relay has no consumer.
  • Enable io-uring's bindgen feature on other architectures: this needs libclang and target kernel headers in every build.

Caused by

moq-dev/moq#8852 made moq-uring an unconditional Linux dependency of moq-relay.

Decisions

  • Pullfrog's note (test build on 32-bit Linux): fixed as it suggested, gating the dev-dependency and the io_uring-only tests on cfg(uring) rather than leaving tests Linux-wide, so cargo test -p moq-relay works where the release build already does.

Follow-ups

  • Under the full just check run, moq-cli args::tests::the_environment_cannot_ask_for_a_moq_side and the_released_name_and_verb_spellings_are_refused timed out at 60s; alone they pass in ~12 ms. Unrelated to this change (pure argument parsing); worth a flake quest if it recurs.

Models

  • Size: S
  • Implementer: Claude, claude-opus-5-5, unknown effort
  • Implementer: Claude Code, claude-opus-5-5, unknown effort

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: 2f5c323

  • Base: origin/main at 0edf6e2

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a1e9b5-4198-7983-bceb-3b82551fc11e, round 1

  • Score: 9/10, The architecture gating is coherent and narrowly scoped, with no actionable regressions found, but builds and tests remain unvalidated as instructed.

  • Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

…ndings

moq-relay depended on moq-uring on every Linux target since #8852, so the
armv7 release build (and `cargo install` on 32-bit Linux) hit io-uring's
compile_error for its prebuilt bindings. A build.rs sets cfg(uring) for
Linux on x86_64, aarch64, riscv64, loongarch64, and powerpc64, matching the
dependency's target, and runtime.io_uring refuses elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 16, 2026 17:30
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 04f14e5b-2ae2-4f85-9b8e-417c52c89c51
Commits

Reviewing files that changed from the base of the PR and between ba74733 and 2f5c323.

Files selected for processing: 20

  • doc/bin/relay/config.md
  • nix/Cargo.nix
  • rs/moq-relay/Cargo.toml
  • rs/moq-relay/build.rs
  • rs/moq-relay/src/auth.rs
  • rs/moq-relay/src/config.rs
  • rs/moq-relay/src/incoming.rs
  • rs/moq-relay/src/internal.rs
  • rs/moq-relay/src/lib.rs
  • rs/moq-relay/src/relay.rs
  • rs/moq-relay/src/runtime.rs
  • rs/moq-relay/tests/integration/bitrate_caps.rs
  • rs/moq-relay/tests/integration/embed.rs
  • rs/moq-relay/tests/integration/handoff.rs
  • rs/moq-relay/tests/integration/main.rs
  • rs/moq-relay/tests/integration/peer_limits.rs
  • rs/moq-relay/tests/integration/refusals.rs
  • rs/moq-relay/tests/integration/runtime_uring.rs
  • rs/moq-relay/tests/integration/tenant_matrix.rs
  • rs/moq-relay/tests/integration/wire_stats.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review by review (OpenAI)

Reviewed d49f6bb98e910d8a8669a10e59b1b115d4a6f8bb. No blocker. The target dependencies, build-script cfg, and Nix graph use the same architecture list as io-uring’s prebuilt bindings. Linux handoff remains independent, and unsupported targets reject explicit io_uring instead of silently choosing another runtime. Keep the armv7 release build as the regression check; I did not independently cross-compile it.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues. One gap remains: the test build on 32-bit Linux.

Reviewed changes

This review covers the one commit that restricts moq-relay's io_uring runtime to Linux targets where io-uring ships prebuilt bindings.

  • Dependency gate: moq-uring and web-transport-proto move from the Linux-wide [dependencies] table to one gated on Linux and the five 64-bit architectures. nix/Cargo.nix gets the same gate.
  • cfg(uring) via build.rs: a new build script sets cfg(uring) for the same targets. Every relay site that touches the io_uring path (lib.rs, relay.rs, internal.rs, incoming.rs, auth.rs) now switches on uring instead of target_os = "linux". The handoff code stays Linux-wide.
  • Config refusal: runtime.io_uring = true is now refused under not(uring), and the error names the supported architectures.
  • Docs: doc/bin/relay/config.md and the runtime.rs field doc now give the architecture requirement.

The library side looks complete. Every moq_uring and crate::uring reference in src/ sits behind uring. The cfg/not(cfg) pairs in relay.rs and internal.rs still cover both cases, and the build script's list matches the Cargo target expression.

ℹ️ The dev-dependency and integration tests are still gated only on Linux

The library build is fixed, but the test build is not. rs/moq-relay/Cargo.toml still has [target.'cfg(target_os = "linux")'.dev-dependencies] moq-uring = { …, features = ["_manual"] }. So cargo test -p moq-relay or cargo check --all-targets on armv7 Linux still compiles io-uring and hits the same compile_error!. The integration tests also call moq_uring and set runtime.io_uring = true under target_os = "linux". On armv7 they would fail to resolve the crate, or would now be refused at config check. The PR's validation ran cargo check without --all-targets, which is why it missed this. The release job isn't affected; this is the "Raspberry Pi user" case from the PR description, applied to tests.

Technical details
# Gate moq-relay's test-side io_uring use on the same architectures

## Affected sites
- rs/moq-relay/Cargo.toml:132 — `[target.'cfg(target_os = "linux")'.dev-dependencies]` pulls `moq-uring` (`_manual`) on every Linux arch
- nix/Cargo.nix — the matching `moq-uring` devDependency entry still has `target = ("linux" == target."os")`
- rs/moq-relay/tests/integration/runtime_uring.rs:8 — `#![cfg(target_os = "linux")]`
- rs/moq-relay/tests/integration/peer_limits.rs:354 — `uring_peer_session_widens_quic_limits` uses `moq_uring::Worker`
- io_uring sites in tests/integration/{embed,tenant_matrix,refusals,wire_stats,handoff,bitrate_caps}.rs that are gated on `target_os = "linux"`

## Required outcome
- `cargo check -p moq-relay --all-targets --target armv7-unknown-linux-gnueabihf` builds, and io-uring is absent from that target's dev graph.

## Suggested approach
- Move `moq-uring` out of the Linux dev-deps into a dev-deps table gated on the same arch `cfg` (keep `socket2` Linux-wide), then regenerate Cargo.nix.
- Build-script `rustc-cfg` also applies to the package's integration tests, so switch the io_uring-only test gates to `cfg(uring)`. Handoff and tokio-worker tests stay on `target_os = "linux"`.

Pullfrog  | Fix it ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

kixelated and others added 2 commits November 17, 2026 05:28
The dev-dependency on moq-uring and the io_uring integration tests were still
Linux-wide, so `cargo test` on armv7 Linux compiled io-uring and hit its
compile_error!. They now follow cfg(uring); handoff and tokio-worker tests stay
Linux-wide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Re Pullfrog's note on the test build: fixed in 6649422. The moq-uring dev-dependency now sits in a table gated on the same architectures (socket2 stays Linux-wide), nix/Cargo.nix is regenerated, and the io_uring-only integration tests switch to cfg(uring), while the handoff and Tokio-worker tests stay on target_os = "linux". cargo check --target armv7-unknown-linux-gnueabihf -p moq-relay --all-targets with -D warnings now passes, with and without test-support. Before this change it failed on io-uring's compile_error!, and the armv7 dev graph no longer has io-uring in it.

(Written by Opus 5.5)

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found. The test-side gap from the prior review is closed.

Reviewed changes

This review covers what changed since the prior Pullfrog review: the test-build gating commit and a merge from main.

  • Dev-dependency gate: moq-uring (_manual) moved into a dev-dependencies table gated on the same Linux-plus-architecture cfg as the normal dependency. socket2 stays Linux-wide, and nix/Cargo.nix mirrors the change.
  • Integration test gates: runtime_uring.rs, bitrate_caps.rs's Dial::Real/mod uring (and its mod gate in main.rs), and the io_uring cases in embed, handoff, peer_limits, refusals, tenant_matrix, and wire_stats moved from target_os = "linux" to cfg(uring).

Every remaining moq_uring and crate::runtime_uring reference under tests/ now sits behind uring. The leftover config.runtime.io_uring = true lines are inside shared helpers that take a backend flag. They only set a config field, and the Tokio callers pass false, so they build on armv7.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 17, 2026

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review by review (OpenAI)
Reviewed commit: 2f5c323c979a685fc3047c23e086f4f12c432c9b

The follow-up closes the test-build gap: rs/moq-relay/Cargo.toml and the generated Nix graph gate the moq-uring dev-dependency on the same architectures as production, and io_uring integration cases now use cfg(uring). Generic Linux handoff tests retain their socket dependency and Tokio coverage. No new actionable issue found by inspection. I did not cross-compile; an armv7 test build, not just the release binary, is the useful regression check for this change.

Merged via the queue into main with commit 3016af6 Nov 17, 2026
7 checks passed
@kixelated
kixelated deleted the fix/relay-uring-arch branch November 17, 2026 13:40
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