diff --git a/Cargo.toml b/Cargo.toml index 78d85e1f237..d1c4790b9d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -210,6 +210,7 @@ pkcs8 = "0.11.0" pollster = "1.0" # default-features off to skip the fork and timeout machinery; crates opt into what they use. proptest = { version = "1.12.0", default-features = false, features = ["std"] } +qlog = "0.18" qmux = { version = "0.7.0", path = "rs/qmux", default-features = false } rand = "0.10.1" rand_pcg = "0.10" diff --git a/cpp/moq/cmake/moq-ffi.cmake b/cpp/moq/cmake/moq-ffi.cmake index f526c6bb732..2e47fead240 100644 --- a/cpp/moq/cmake/moq-ffi.cmake +++ b/cpp/moq/cmake/moq-ffi.cmake @@ -2,7 +2,6 @@ # (MOQ_FFI_DIR), or a cargo build of this checkout. Sets MOQ_FFI_LIB (the staticlib to link), # MOQ_FFI_METADATA (the cdylib uniffi-bindgen-cpp reads), MOQ_FFI_CARGO (the target that builds # them, or empty for a prebuilt input), and MOQ_NATIVE_LIBS (what an external linker adds). -# MOQ_FFI_QLOG adds moq-ffi's qlog feature to the cargo build, which a prebuilt input lacks. # # Run with -P, it is that cargo build: it links the libraries cargo reports into OUT, so no # cargo setting (target-dir, build.target) can move them from where the packages look. @@ -21,12 +20,6 @@ if(CMAKE_SCRIPT_MODE_FILE) if(RELEASE) list(APPEND _args --release) endif() - # A cdylib's file name carries no feature hash, so a qlog build takes a target directory of - # its own rather than replacing the default library every other binding loads. - if(QLOG) - string(APPEND _target_dir "/qlog") - list(APPEND _args --features qlog --target-dir "${_target_dir}") - endif() execute_process( COMMAND cargo ${_args} WORKING_DIRECTORY "${WORKSPACE}" @@ -119,12 +112,7 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) endif() set(MOQ_FFI_DIR "" CACHE PATH "Extracted default-feature moq-ffi native package") -option(MOQ_FFI_QLOG "Build moq-ffi from source with qlog trace capture" OFF) if(MOQ_FFI_DIR) - if(MOQ_FFI_QLOG) - message(FATAL_ERROR "MOQ_FFI_QLOG requires a source build of moq-ffi; MOQ_FFI_DIR " - "carries default features only") - endif() get_filename_component(MOQ_FFI_DIR "${MOQ_FFI_DIR}" ABSOLUTE) file(READ "${MOQ_FFI_DIR}/manifest.json" _manifest) foreach(_field version target features profile source) @@ -163,13 +151,8 @@ else() "or architecture, set MOQ_FFI_DIR to a native package for it") endif() # The top-level build tree, so a project adding both packages shares one cargo build and - # one rule for its outputs, as Ninja requires. A qlog build links into a directory of its - # own: the hard link keeps cargo's timestamp, so toggling MOQ_FFI_QLOG in place could swap - # in an older library that nothing relinks against, while a new path changes the commands. + # one rule for its outputs, as Ninja requires. set(_out "${CMAKE_BINARY_DIR}/moq-ffi") - if(MOQ_FFI_QLOG) - string(APPEND _out "-qlog") - endif() set(MOQ_FFI_LIB "${_out}/${_moq_ffi_static}") set(MOQ_FFI_METADATA "${_out}/${_moq_ffi_dynamic}") set(MOQ_FFI_CARGO moq_ffi_cargo) @@ -183,7 +166,6 @@ else() add_custom_target(moq_ffi_cargo COMMAND "${CMAKE_COMMAND}" -DWORKSPACE=${_moq_workspace} -DOUT=${_out} -DSTATIC=${_moq_ffi_static} -DDYNAMIC=${_moq_ffi_dynamic} -DRELEASE=${_release} - -DQLOG=${MOQ_FFI_QLOG} -P "${CMAKE_CURRENT_LIST_FILE}" BYPRODUCTS "${MOQ_FFI_LIB}" "${MOQ_FFI_METADATA}" COMMENT "Building moq-ffi" diff --git a/cpp/obs/CMakeLists.txt b/cpp/obs/CMakeLists.txt index 2134b02a392..7d5204005d7 100644 --- a/cpp/obs/CMakeLists.txt +++ b/cpp/obs/CMakeLists.txt @@ -22,14 +22,6 @@ if(MOQ_LOCAL AND EXISTS "${MOQ_LOCAL}/cpp/moq/CMakeLists.txt") set(_moq_local_build TRUE) endif() -# Off by default, like moq-ffi's feature. The release archive and a prebuilt MOQ_FFI_DIR carry -# default features only, so refuse here, before the OBS dependencies download, rather than -# silently building without it. -option(MOQ_FFI_QLOG "Build moq-ffi with qlog, which shows the qlog directory setting" OFF) -if(MOQ_FFI_QLOG AND (NOT _moq_local_build OR MOQ_FFI_DIR)) - message(FATAL_ERROR "MOQ_FFI_QLOG requires the in-tree build: set MOQ_LOCAL and clear MOQ_FFI_DIR") -endif() - if(_moq_local_build) file(STRINGS "${MOQ_LOCAL}/cpp/moq/VERSION" _moq_link_version LIMIT_COUNT 1) if(NOT _moq_link_version MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+$") diff --git a/cpp/obs/justfile b/cpp/obs/justfile index 33242569730..cf528bc990a 100644 --- a/cpp/obs/justfile +++ b/cpp/obs/justfile @@ -37,15 +37,13 @@ compile: ../../sh/obs/compile.sh # Compile and link the plugin the way CI does, against the `.#obs` shell's own -# libobs/Qt6/ffmpeg, then run the unit tests and check that MOQ_FFI_QLOG builds -# moq-ffi with qlog. Linux-only in practice: it's the one platform where nixpkgs +# libobs/Qt6/ffmpeg, then run the unit tests. Linux-only in practice: it's the one platform where nixpkgs # has obs-studio. The Debug build type reuses the dev-profile Rust artifacts CI # restores, where a release moq-ffi would rebuild its whole dependency tree. ci preset="": cmake --preset "$(../../sh/obs/preset.sh '{{ preset }}' ci)" -DCMAKE_BUILD_TYPE=Debug cmake --build --preset "$(../../sh/obs/preset.sh '{{ preset }}' ci)" ../../sh/obs/unit.sh - ../../sh/obs/qlog.sh # Unit-test the plugin sources against stubbed libobs and ffmpeg and the real # moq-ffi, under ThreadSanitizer. Nightly runs it; `just obs ci` runs them diff --git a/cpp/obs/src/moq-settings.cpp b/cpp/obs/src/moq-settings.cpp index 1d49245e934..f8c56abb9e8 100644 --- a/cpp/obs/src/moq-settings.cpp +++ b/cpp/obs/src/moq-settings.cpp @@ -229,13 +229,9 @@ const std::vector &Fields() f.push_back(Choose(QUIC_MTU_DISCOVERY, "Path MTU discovery", AutoOnOff(), false, "Probe the path so packets use the largest size it allows. Turn it " "off if discovery itself causes drops.")); - // Only when this build can capture: setting a directory without support fails - // the dial, so offering it would be a control that only breaks things. - if (moq::qlog_supported()) { - f.push_back(Directory(QUIC_QLOG, "qlog directory", - "Write QUIC connection traces here for diagnosing stalls. Leave " - "empty to disable; the files get large.")); - } + f.push_back(Directory(QUIC_QLOG, "qlog directory", + "Write QUIC connection traces here for diagnosing stalls. Leave " + "empty to disable; the files get large.")); f.push_back(Toggle(QUIC_KEYLOG, "TLS key log", false, "Write TLS session secrets to the file the SSLKEYLOGFILE environment " "variable names, to decrypt a packet capture. Anyone holding that file " @@ -361,15 +357,8 @@ std::string Configure(obs_data_t *settings, moq::ClientConfig &config) config.quic.keep_alive = Milliseconds(settings, QUIC_KEEP_ALIVE, error); config.quic.gso = TriState(settings, QUIC_GSO, error); config.quic.mtu_discovery = TriState(settings, QUIC_MTU_DISCOVERY, error); - // A scene collection written by a qlog-capable build keeps the key even where the - // field is hidden. Refusing would block Go Live on a setting the user can no longer - // see, let alone clear, so the trace is skipped and the log says why. - if (const char *qlog = OptionalString(settings, QUIC_QLOG)) { - if (moq::qlog_supported()) - config.quic.qlog = qlog; - else - LOG_WARNING("Skipping the qlog directory %s: this build cannot write qlog", qlog); - } + if (const char *qlog = OptionalString(settings, QUIC_QLOG)) + config.quic.qlog = qlog; config.quic.keylog = obs_data_get_bool(settings, QUIC_KEYLOG); config.websocket.enabled = obs_data_get_bool(settings, WEBSOCKET_ENABLED); diff --git a/dart/moq/lib/src/client.dart b/dart/moq/lib/src/client.dart index 1a08597ab73..3b818ad5958 100644 --- a/dart/moq/lib/src/client.dart +++ b/dart/moq/lib/src/client.dart @@ -131,7 +131,7 @@ final class QuicConfig { /// The congestion control family; null leaves the choice to the backend. final CongestionControl? congestionControl; - /// Directory to write qlog traces into; fails unless [qlogSupported]. + /// Directory, which must exist, to write qlog traces into. final String? qlog; /// Danger: write TLS session secrets to the file `SSLKEYLOGFILE` names, for @@ -182,9 +182,6 @@ final class WebSocketConfig { /// way [ConnectOptions.versions] takes them. List versions() => moqVersions(); -/// Whether this build can write qlog traces for [QuicConfig.qlog]. -bool qlogSupported() => moqQlogSupported(); - /// A MoQ session with publishing and subscription conveniences. final class Moq { final Client _client; diff --git a/dart/moq_ffi/lib/src/moq.dart b/dart/moq_ffi/lib/src/moq.dart index c31fe28b639..eb918411a79 100644 --- a/dart/moq_ffi/lib/src/moq.dart +++ b/dart/moq_ffi/lib/src/moq.dart @@ -20316,14 +20316,6 @@ MoqClientConfig moqClientDefaults() { ); } -bool moqQlogSupported() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_func_moq_qlog_supported(status), - FfiConverterBool.lift, - null, - ); -} - List moqVersions() { return rustCallWithLifter( (status) => uniffi_moq_ffi_fn_func_moq_versions(status), @@ -23780,11 +23772,6 @@ external RustBuffer uniffi_moq_ffi_fn_func_moq_client_defaults( Pointer uniffiStatus, ); -@Native)>(assetId: _uniffiAssetId) -external int uniffi_moq_ffi_fn_func_moq_qlog_supported( - Pointer uniffiStatus, -); - @Native)>(assetId: _uniffiAssetId) external RustBuffer uniffi_moq_ffi_fn_func_moq_versions( Pointer uniffiStatus, @@ -24131,9 +24118,6 @@ external int uniffi_moq_ffi_checksum_func_moq_log_level(); @Native(assetId: _uniffiAssetId) external int uniffi_moq_ffi_checksum_func_moq_client_defaults(); -@Native(assetId: _uniffiAssetId) -external int uniffi_moq_ffi_checksum_func_moq_qlog_supported(); - @Native(assetId: _uniffiAssetId) external int uniffi_moq_ffi_checksum_func_moq_versions(); @@ -25028,9 +25012,6 @@ void _checkApiChecksums() { if (uniffi_moq_ffi_checksum_func_moq_client_defaults() != 15294) { throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); } - if (uniffi_moq_ffi_checksum_func_moq_qlog_supported() != 58291) { - throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); - } if (uniffi_moq_ffi_checksum_func_moq_versions() != 28954) { throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); } diff --git a/doc/bin/obs.md b/doc/bin/obs.md index 9f390dd6cb4..8774b8d71f8 100644 --- a/doc/bin/obs.md +++ b/doc/bin/obs.md @@ -142,21 +142,14 @@ Xcode or Visual Studio 2022, plus Rust and [`uniffi-bindgen-cpp`](/lib/cpp/) to build the C++ package in-tree; see [`cpp/obs/`](https://github.com/moq-dev/moq/tree/main/cpp/obs). -To capture qlog traces, configure a source build with `-DMOQ_FFI_QLOG=ON`, for -example `cmake --preset ubuntu-x86_64 -DMOQ_FFI_QLOG=ON` before `just obs build`. -It builds moq-ffi with its `qlog` feature, which adds a qlog directory to the -advanced settings. It is off by default, and the prebuilt archives leave it -out, so configuration fails if the C++ package would come from a release -archive or `MOQ_FFI_DIR`. - ## Advanced settings Off by default; the defaults suit a normal relay. They cover what you would otherwise pass to `moq` on the command line: pinning a protocol version, the local bind address and connect timing, trusting a self-signed relay or private CA, reconnect pacing, QUIC tuning (congestion control, idle timeout, -keep-alive, segmentation offload, MTU discovery, and qlog traces when the build -supports them), and the WebSocket fallback race. A keep-alive interval of 0 +keep-alive, segmentation offload, MTU discovery, and qlog traces), and the +WebSocket fallback race. A keep-alive interval of 0 uses the negotiated idle timeout to choose how often to ping. A rejected value stops the stream with the reason in the log rather than silently using a default. To decrypt a packet capture, turn on **TLS key log** here or in a MoQ Source's diff --git a/doc/bin/relay/config.md b/doc/bin/relay/config.md index 2e2bf3ed749..e7ef6ef3d57 100644 --- a/doc/bin/relay/config.md +++ b/doc/bin/relay/config.md @@ -125,7 +125,7 @@ mtu_discovery = false # Path MTU discovery. Default. receive_window = 4194304 # Whole-connection window, in bytes. Default (4 MiB). stream_receive_window = 1048576 # Per-stream window, in bytes. Default (1 MiB). send_window = 4194304 # Unacknowledged outgoing data, in bytes. Default (4 MiB). -qlog = "/var/log/moq/qlog" # Existing directory. Needs the `qlog` build feature. +qlog = "/var/log/moq/qlog" # Existing directory. # keylog = "/private/keys.log" # Explicit secret log path; unset is off. ``` diff --git a/doc/lib/cpp/index.md b/doc/lib/cpp/index.md index bc483a497b6..0df8d916c93 100644 --- a/doc/lib/cpp/index.md +++ b/doc/lib/cpp/index.md @@ -50,10 +50,7 @@ metadata library and links its static library without compiling Rust. Without an explicit directory, a release pin in `cpp/moq/FFI_VERSION` selects the default input; `just cpp package` fetches it with the checked-in SHA-256 hashes and fails if it cannot verify it. Direct CMake builds and `just cpp check` build the -current checkout unless given an explicit native directory. A source build -with `-DMOQ_FFI_QLOG=ON` adds moq-ffi's `qlog` feature, so -`moq::qlog_supported()` reports true and `QuicConfig::qlog` writes traces; it builds -in its own cargo target directory, and a prebuilt input refuses it. The package is +current checkout unless given an explicit native directory. The package is `moq-cpp`. It and the C package, `moq-c`, each link in their own copy of the Rust core, so a program links one of the two, never both. diff --git a/go/wrapper/client.go b/go/wrapper/client.go index 1bb3b43fca5..97c7542dc05 100644 --- a/go/wrapper/client.go +++ b/go/wrapper/client.go @@ -107,8 +107,7 @@ type QUICConfig struct { MTUDiscovery *bool // CongestionControl picks the congestion control family; nil leaves the choice to the backend. CongestionControl *CongestionControl - // Qlog is a directory, which must exist, to write qlog traces into. Dial - // fails unless QlogSupported. + // Qlog is a directory, which must exist, to write qlog traces into. Qlog string // Keylog writes TLS session secrets to the file SSLKEYLOGFILE names, for // decrypting a capture. Without SSLKEYLOGFILE the dial fails. diff --git a/go/wrapper/types.go b/go/wrapper/types.go index 7556778a792..a38b8625881 100644 --- a/go/wrapper/types.go +++ b/go/wrapper/types.go @@ -192,11 +192,6 @@ func Versions() []string { return ffi.MoqVersions() } -// QlogSupported reports whether this build can write qlog traces for QUICConfig.Qlog. -func QlogSupported() bool { - return ffi.MoqQlogSupported() -} - // LogLevel configures the native tracing log level (e.g. "info", "debug"). func LogLevel(level string) error { return ffi.MoqLogLevel(level) diff --git a/kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Client.kt b/kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Client.kt index 51775f805f0..43d80462c8f 100644 --- a/kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Client.kt +++ b/kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Client.kt @@ -6,9 +6,6 @@ package dev.moq */ fun versions(): List = uniffi.moq.moqVersions() -/** Whether this build can write qlog traces for [QuicConfig.qlog]. */ -fun qlogSupported(): Boolean = uniffi.moq.moqQlogSupported() - /** * The caller's product tokens, if any, then this package's, which moq-ffi advertises ahead of its * own. diff --git a/nix/Cargo.nix b/nix/Cargo.nix index 6892a86186d..b287d21e790 100644 --- a/nix/Cargo.nix +++ b/nix/Cargo.nix @@ -18634,7 +18634,6 @@ rec { "dep:winit" ]; "pulseaudio" = [ "moq-audio?/pulseaudio" ]; - "qlog" = [ "moq-tokio/qlog" ]; "s3" = [ "object_store/aws-base" "object_store/reqwest" @@ -18665,7 +18664,6 @@ rec { "pipewire" "play" "pulseaudio" - "qlog" "s3" "transcode" "v4l2" @@ -19028,12 +19026,10 @@ rec { ]; features = { "openh264" = [ "moq-video/openh264" ]; - "qlog" = [ "moq-tokio/qlog" ]; "testing" = [ "kio/manual" ]; }; resolvedDefaultFeatures = [ "openh264" - "qlog" "testing" ]; }; @@ -20205,7 +20201,6 @@ rec { { name = "qlog"; packageId = "qlog"; - optional = true; } { name = "rand"; @@ -20328,12 +20323,10 @@ rec { "dep:arbitrary" "sim" ]; - "qlog" = [ "dep:qlog" ]; }; resolvedDefaultFeatures = [ "default" "fuzz" - "qlog" "sim" ]; }; @@ -20756,10 +20749,6 @@ rec { ]; features = { "jemalloc" = [ "moq-tokio/jemalloc" ]; - "qlog" = [ - "moq-tokio/qlog" - "moq-uring/qlog" - ]; "test-support" = [ "kio/sim" "moq-tokio/sim" @@ -20767,7 +20756,6 @@ rec { }; resolvedDefaultFeatures = [ "jemalloc" - "qlog" "test-support" ]; }; @@ -21783,7 +21771,6 @@ rec { "dep:tikv-jemallocator" "dep:tikv-jemalloc-ctl" ]; - "qlog" = [ "moq-quic/qlog" ]; "sim" = [ "kio/sim" "moq-quic/sim" @@ -21791,7 +21778,6 @@ rec { }; resolvedDefaultFeatures = [ "jemalloc" - "qlog" "sim" ]; }; @@ -22190,7 +22176,6 @@ rec { "_manual" = [ "kio/manual" ]; "default" = [ "quic" ]; "fuzz" = [ "moq-sock/fuzz" ]; - "qlog" = [ "moq-quic?/qlog" ]; "quic" = [ "dep:moq-congestion" "dep:moq-crypto" @@ -22203,7 +22188,6 @@ rec { "_probe" "default" "fuzz" - "qlog" "quic" ]; }; diff --git a/py/moq-rs/README.md b/py/moq-rs/README.md index 30f8706466b..a8089509f7d 100644 --- a/py/moq-rs/README.md +++ b/py/moq-rs/README.md @@ -141,7 +141,7 @@ client = moq.Client( - `fingerprints`. Hex SHA-256 fingerprint(s) to pin the peer's certificate to, the native equivalent of `serverCertificateHashes`. Accepts the values a server reports via `cert_fingerprints()`, so you can trust a self-signed certificate without `insecure=True`. - `cert`, `key`. Paired PEM certificate chain and private key paths for mTLS. - `host_name`. Verify the certificate against this name (SNI) instead of the URL's host. - - `quic=QuicConfig(...)`. QUIC tuning: `max_streams` raises the peer's inbound stream cap; `idle_timeout`, `keep_alive` (`timedelta(0)` uses the default), `gso`, `mtu_discovery`, `congestion_control` (a `CongestionControl`, such as `CongestionControl.delay()`), and `qlog` (a trace directory when `qlog_supported()`). `keylog=True` writes TLS session secrets to the file `SSLKEYLOGFILE` names, for decrypting a capture; without `SSLKEYLOGFILE` the client refuses to build. + - `quic=QuicConfig(...)`. QUIC tuning: `max_streams` raises the peer's inbound stream cap; `idle_timeout`, `keep_alive` (`timedelta(0)` uses the default), `gso`, `mtu_discovery`, `congestion_control` (a `CongestionControl`, such as `CongestionControl.delay()`), and `qlog` (a trace directory, which must exist). `keylog=True` writes TLS session secrets to the file `SSLKEYLOGFILE` names, for decrypting a capture; without `SSLKEYLOGFILE` the client refuses to build. - `websocket=WebSocketConfig(...)`. The fallback raced against QUIC: `enabled=False` turns it off, and `delay` is QUIC's head start. - `once`, `backoff`. Redial with a `Backoff` when the transport drops; `once=True` dials once. - `.session`. The connecting or connected `Session` (or `None` before entering / after exit). diff --git a/py/moq-rs/moq/__init__.py b/py/moq-rs/moq/__init__.py index be9c5ce0c52..e8ecfb5a11b 100644 --- a/py/moq-rs/moq/__init__.py +++ b/py/moq-rs/moq/__init__.py @@ -11,7 +11,7 @@ from . import json as json from . import socket as socket from . import video as video -from .client import Client, CongestionControl, connect, qlog_supported, versions +from .client import Client, CongestionControl, connect, versions from .datagram import DatagramConsumer, DatagramProducer, DatagramRequest, DatagramRequests from .errors import is_auth, is_shutdown, protocol_error from .log import log_level @@ -191,7 +191,6 @@ "is_shutdown", "log_level", "protocol_error", - "qlog_supported", "versions", ] diff --git a/py/moq-rs/moq/_records.py b/py/moq-rs/moq/_records.py index f7f94c9ea75..59d1bb9a064 100644 --- a/py/moq-rs/moq/_records.py +++ b/py/moq-rs/moq/_records.py @@ -411,7 +411,7 @@ class QuicConfig: raised. ``idle_timeout`` is how long an idle connection survives, and ``keep_alive`` the ping interval (zero uses the default). ``gso``, ``mtu_discovery``, and ``congestion_control`` leave the choice to the backend when ``None``. ``qlog`` is a - directory, which must exist, for qlog traces when :func:`qlog_supported`. + directory, which must exist, for qlog traces. ``keylog=True`` writes TLS session secrets to the file ``SSLKEYLOGFILE`` names, for decrypting a capture; without ``SSLKEYLOGFILE`` the client refuses to build. ``None`` keeps the library default throughout. diff --git a/py/moq-rs/moq/client.py b/py/moq-rs/moq/client.py index 5b33f546e41..2438be3bf7f 100644 --- a/py/moq-rs/moq/client.py +++ b/py/moq-rs/moq/client.py @@ -10,7 +10,6 @@ MoqClient, MoqClientConfig, MoqCongestionControl, - moq_qlog_supported, moq_versions, ) @@ -37,11 +36,6 @@ def versions() -> list[str]: return moq_versions() -def qlog_supported() -> bool: - """Whether this build can write qlog traces; ``qlog`` raises `moq.Error` otherwise.""" - return moq_qlog_supported() - - class Client: """High-level MoQ client with automatic origin wiring. diff --git a/quest/m2/features-qlog.md b/quest/m2/features-qlog.md deleted file mode 100644 index 3464ef9c79d..00000000000 --- a/quest/m2/features-qlog.md +++ /dev/null @@ -1,37 +0,0 @@ -# [S] Always compile qlog - -## Goal - -qlog trace capture compiles into every build that has QUIC, and the existing -runtime switches (`--quic-qlog `, `--client-quic-qlog `, -`quic::Transport::qlog`, moq-ffi's and the C++ wrapper's qlog option) are the -only way to turn it on. The `qlog` features of moq-quic, moq-tokio, moq-uring, -moq-relay, moq-cli, and moq-ffi, and the C++ `MOQ_FFI_QLOG` CMake option, go -away. - -## Plan - -Found by the [Cargo feature review](/quest/m3/release/feature-flags.md) (first -pass, 2026-11-14). Decided 2026-11-14 (maintainer, /quest-complete): ✅ keep -this quest in m2 (rejected: drop it). - -The features exist so "production builds do not pull in the -qlog crate and its serde_json encoder". Measured with `cargo tree -e normal`, -`qlog` adds one crate to moq-relay (`qlog` itself; serde, serde_json, and -serde_with are already there) and 16 to moq-quic alone. It costs about 30 `cfg` -sites in moq-quic and 10 in moq-uring, and it means an operator who hits a -congestion bug on a shipped relay has to rebuild before they can trace it. - -Confirm that a connection with qlog off pays nothing on the hot path (the -writer is `None` and no event is built) before removing the gate; if it does -pay, fix that in the same PR rather than keep the feature. - -Breaking for anyone who names `qlog` in a manifest or passes -`-DMOQ_FFI_QLOG=ON`: the PR's Impact section says to delete it. A prebuilt -moq-ffi then carries qlog, so `cpp/moq/cmake/moq-ffi.cmake` drops its check -that a prebuilt input lacks it, and moq-ffi's `moq_qlog_supported` (always -true then) is deleted from every binding with its "fails unless supported" -doc on `MoqQuicConfig::qlog`. `doc/bin/relay/config.md` drops "Needs the -`qlog` build feature", `doc/bin/obs.md` drops its `-DMOQ_FFI_QLOG=ON` source -build for traces, and the `rs/justfile` uring recipes drop `moq-relay/qlog` -from their clippy run and `--features qlog` from moq-uring's nextest run. diff --git a/quest/m3/release/feature-flags.md b/quest/m3/release/feature-flags.md index c8e47b0ecf4..e24c7661691 100644 --- a/quest/m3/release/feature-flags.md +++ b/quest/m3/release/feature-flags.md @@ -41,10 +41,10 @@ judged, so this pass reads only the difference: that look heavy on their crate add one or two crates to moq-relay or moq-cli. Diff this pass's inventory against the first pass's to find what m2 added. - Filed: network stack (landed in - [moq-dev/moq#8852](https://github.com/moq-dev/moq/pull/8852)), - [qlog](/quest/m2/features-qlog.md), and the media and gateway trims - ([moq-dev/moq#8851](https://github.com/moq-dev/moq/pull/8851)). Check each - landed or was dropped. + [moq-dev/moq#8852](https://github.com/moq-dev/moq/pull/8852)), qlog (landed + in [moq-dev/moq#8853](https://github.com/moq-dev/moq/pull/8853)), and the + media and gateway trims + ([moq-dev/moq#8851](https://github.com/moq-dev/moq/pull/8851)). - Kept, with the reason a new feature has to match: - `async` in kio, moq-net, hang, moq-json, moq-mux, moq-stats, moq-hls, moq-crypto, and moq-auth: the poll-first design (decided 2026-11-05 in diff --git a/rs/justfile b/rs/justfile index 6c538f5c0ba..29a6debb5c2 100644 --- a/rs/justfile +++ b/rs/justfile @@ -141,8 +141,6 @@ uring *args: cargo test --locked -p moq-relay --test integration # Needs a second IPv6 address on lo, which the io_uring CI lanes add. bash sh/rs/nextest.sh cargo nextest run --locked -p moq-uring --test integration --run-ignored only -E 'test(=local_addr::a_v6_wildcard_answers_from_the_address_reached)' "$@" - bash sh/local.sh cargo clippy --locked -p moq-uring -p moq-relay --features moq-relay/qlog --all-targets "$@" -- -D warnings - bash sh/rs/nextest.sh cargo nextest run --locked -p moq-uring --features qlog --tests "$@" # The Apple-gated code in moq-video, moq-audio, and moq-sock, which # platform.yml compiles on a Mac runner alongside `windows`. diff --git a/rs/moq-c/src/api.rs b/rs/moq-c/src/api.rs index 90ad5b0f964..8c7bb4d3d25 100644 --- a/rs/moq-c/src/api.rs +++ b/rs/moq-c/src/api.rs @@ -1468,16 +1468,6 @@ pub unsafe extern "C" fn moq_versions(dst: *mut moq_string, count: usize) -> i32 }) } -/// Whether this build can capture qlog traces. -/// -/// Capture is compile-time optional. [moq_client_config]'s `quic_qlog` accepts a directory -/// either way, but dialing fails when the support is absent, so a caller offering the -/// knob should hide it rather than surface an option that cannot work. -#[unsafe(no_mangle)] -pub extern "C" fn moq_qlog_supported() -> bool { - moq_tokio::qlog_supported() -} - /// A [moq_subscription] with moq-net's defaults, whose zero `delay` starts at the newest /// group and skips a superseded one at once. A NULL subscription pointer or a zeroed struct /// means the same; start from this struct to change a field. @@ -1636,8 +1626,7 @@ pub struct moq_client_config { /// The length in bytes of `quic_congestion_control`. pub quic_congestion_control_len: usize, - /// Directory to write qlog traces into, or NULL for none. Capture is - /// compile-time optional; see [moq_qlog_supported]. + /// Directory, which must exist, to write qlog traces into, or NULL for none. pub quic_qlog: *const c_char, /// The length in bytes of `quic_qlog`. pub quic_qlog_len: usize, @@ -1971,7 +1960,7 @@ pub struct moq_server_config { pub quic_congestion_control: *const c_char, /// The length in bytes of `quic_congestion_control`. pub quic_congestion_control_len: usize, - /// A directory to write qlog traces into, or NULL for none; see [moq_qlog_supported]. + /// A directory, which must exist, to write qlog traces into, or NULL for none. pub quic_qlog: *const c_char, /// The length in bytes of `quic_qlog`. pub quic_qlog_len: usize, diff --git a/rs/moq-c/src/test.rs b/rs/moq-c/src/test.rs index addf41784ea..b790ff6215f 100644 --- a/rs/moq-c/src/test.rs +++ b/rs/moq-c/src/test.rs @@ -7657,15 +7657,12 @@ fn config_quic_and_backoff_knobs_apply() { ); } -/// Whether a qlog directory works at all is a compile-time feature, so the capability -/// has to agree with what a dial does. Both branches matter: `just check` runs without -/// `--all-features` and only ever sees the unsupported one, while CI runs with them and -/// only sees the supported one. -#[test] -fn qlog_support_matches_what_a_dial_accepts() { - // A real directory: with capture compiled in, the dial creates a trace file inside - // it, so a path that doesn't exist would fail for that reason instead of the one - // under test. The pid keeps concurrent test binaries out of each other's way. +/// A dial with a qlog directory starts, since every build captures qlog. +#[test] +fn dial_accepts_a_qlog_directory() { + // A real directory: the dial creates a trace file inside it, so a path that doesn't + // exist would fail for that reason instead. The pid keeps concurrent test binaries + // out of each other's way. let dir = std::env::temp_dir().join(format!("moq-qlog-test-{}", std::process::id())); std::fs::create_dir_all(&dir).expect("create the qlog directory"); let path = dir.to_str().expect("temp dir is UTF-8").to_string(); @@ -7674,17 +7671,11 @@ fn qlog_support_matches_what_a_dial_accepts() { config.quic_qlog = path.as_ptr() as *const c_char; config.quic_qlog_len = path.len(); - // Parsing stores the path either way; the dial is what rejects it. assert!(unsafe { crate::parse_client(Some(&config)) }.is_ok()); let ret = dial(Some(&config)); - match moq_qlog_supported() { - true => { - assert!(ret > 0, "qlog is supported, so the dial must start: {ret}"); - moq_session_close(id(ret)); - } - false => assert!(ret < 0, "qlog is unsupported, so the dial must be refused"), - } + assert!(ret > 0, "the dial must start: {ret}"); + moq_session_close(id(ret)); std::fs::remove_dir_all(&dir).ok(); } diff --git a/rs/moq-cli/Cargo.toml b/rs/moq-cli/Cargo.toml index 0f52834e899..e6f1ccf3938 100644 --- a/rs/moq-cli/Cargo.toml +++ b/rs/moq-cli/Cargo.toml @@ -40,10 +40,6 @@ doc = false [features] default = ["nvidia", "v4l2", "vaapi", "s3", "gcs", "azure"] jemalloc = ["moq-tokio/jemalloc"] -# qlog trace capture (`--client-quic-qlog `). Off by default: it compiles the -# qlog machinery into the enabled backends and is only wanted for debugging or -# congestion-control testing. -qlog = ["moq-tokio/qlog"] # The cloud object stores `export archive` and `import archive` reach (`s3://`, # `gs://`, `az://`), signing through rind and connecting through reqwest. Local # `file://` URLs need none of them. diff --git a/rs/moq-ffi/Cargo.toml b/rs/moq-ffi/Cargo.toml index 884c3c35164..88ef4d20d3a 100644 --- a/rs/moq-ffi/Cargo.toml +++ b/rs/moq-ffi/Cargo.toml @@ -21,9 +21,6 @@ crate-type = ["staticlib", "cdylib"] # CI's tests turn it on. It is the only encoder on API-24 Android and the Apple # simulators, so every release build needs it. openh264 = ["moq-video/openh264"] -# qlog trace capture (`MoqQuicConfig::qlog`). Off by default: it compiles the qlog -# machinery in and is only wanted for debugging; `moq_qlog_supported` reports it. -qlog = ["moq-tokio/qlog"] # Test-only hooks for the host suites: control of the runtime clock (`just py test`) and a # count of moq's heap (the Dart leak tests). Released builds leave it off, so they never # carry the `moq_ffi_test_*` symbols or the counting allocator. diff --git a/rs/moq-ffi/src/session.rs b/rs/moq-ffi/src/session.rs index 65aa3c4c3ae..2e7210eb187 100644 --- a/rs/moq-ffi/src/session.rs +++ b/rs/moq-ffi/src/session.rs @@ -130,8 +130,7 @@ pub struct MoqQuicConfig { /// The congestion control family. #[uniffi(default = None)] pub congestion_control: Option>, - /// Directory, which must exist, to write qlog traces into. Fails `new` unless - /// [`moq_qlog_supported`]. + /// Directory, which must exist, to write qlog traces into. #[uniffi(default = None)] pub qlog: Option, /// Danger: write TLS session secrets to the file `SSLKEYLOGFILE` names, for decrypting a @@ -292,12 +291,6 @@ pub fn moq_versions() -> Vec { moq_net::Versions::all().iter().map(ToString::to_string).collect() } -/// Whether this build can write qlog traces, so a UI can hide `MoqQuicConfig::qlog` otherwise. -#[uniffi::export] -pub fn moq_qlog_supported() -> bool { - moq_tokio::qlog_supported() -} - /// Parse protocol version names, as `MoqClientConfig::versions` and /// `MoqServerConfig::versions` spell them. pub(crate) fn parse_versions(versions: &[String]) -> Result, MoqError> { diff --git a/rs/moq-ffi/src/test.rs b/rs/moq-ffi/src/test.rs index 021ee9860bb..edc780240a0 100644 --- a/rs/moq-ffi/src/test.rs +++ b/rs/moq-ffi/src/test.rs @@ -18,7 +18,7 @@ use crate::json::{ use crate::media::*; use crate::session::{ MoqBackoff, MoqCongestionControl, MoqConnectionPhase, MoqQuicConfig, MoqWebSocketConfig, moq_client_defaults, - moq_qlog_supported, moq_versions, + moq_versions, }; use std::future::Future; @@ -6610,20 +6610,6 @@ async fn server_new_validates_the_config() { ..Default::default() }); assert!(matches!(version, Err(MoqError::Config { .. }))); - - // A build that cannot write qlog refuses the directory here, not later as a bind error. - let qlog = MoqServer::new(MoqServerConfig { - quic: MoqQuicConfig { - qlog: Some(std::env::temp_dir().display().to_string()), - ..Default::default() - }, - ..Default::default() - }); - if moq_qlog_supported() { - assert!(qlog.is_ok()); - } else { - assert!(matches!(qlog, Err(MoqError::Config { .. }))); - } } /// The defaults convert back to moq-net's own, so they mean the same as no subscription. @@ -6699,12 +6685,11 @@ async fn client_new_validates_the_connection_knobs() { Err(MoqError::Config { .. }) )); - // A build that cannot write qlog refuses the directory rather than dropping it. let qlog = MoqQuicConfig { qlog: Some(std::env::temp_dir().display().to_string()), ..Default::default() }; - assert_eq!(client(MoqClientTls::default(), qlog).is_ok(), moq_qlog_supported()); + assert!(client(MoqClientTls::default(), qlog).is_ok()); } /// A client with `quic.keylog` on, dialing `localhost` pinned to `fingerprints`. diff --git a/rs/moq-quic/Cargo.toml b/rs/moq-quic/Cargo.toml index 60b9a326a2d..2b2fe0b32d7 100644 --- a/rs/moq-quic/Cargo.toml +++ b/rs/moq-quic/Cargo.toml @@ -13,8 +13,6 @@ categories = ["network-programming", "asynchronous"] [features] default = [] -# Enable qlog support -qlog = ["dep:qlog"] # The seeded, impaired network path (`sim::Link`) the tests run endpoints across, for a # driver that runs QUIC on kio's simulator. Meant for dev-dependencies. sim = [] @@ -36,7 +34,7 @@ lru-slab = "0.1.2" moq-congestion = { workspace = true } # rind's rustls provider and the `UnsupportedCpu` error the transport crates share. moq-crypto = { workspace = true, features = ["provider"] } -qlog = { version = "0.18", optional = true } +qlog = { workspace = true } rand = { workspace = true } rind = { workspace = true } rustc-hash = { workspace = true } diff --git a/rs/moq-quic/src/config/transport/mod.rs b/rs/moq-quic/src/config/transport/mod.rs index d9f5064b8c8..e30ed26ae40 100644 --- a/rs/moq-quic/src/config/transport/mod.rs +++ b/rs/moq-quic/src/config/transport/mod.rs @@ -13,7 +13,6 @@ use crate::{ pub mod ack_frequency; pub mod datagram; pub mod mtu; -#[cfg(feature = "qlog")] pub mod qlog; /// The expected round trip time the default windows are tuned for, in milliseconds @@ -185,7 +184,6 @@ pub struct Config { pub segmentation_offload: bool, /// Where to write qlog traces, or `None` (the default) to write none - #[cfg(feature = "qlog")] pub qlog: Option, /// Whether to advertise support for receiving RESET_STREAM_AT @@ -255,10 +253,7 @@ impl Config { } pub(crate) fn qlog_sink(&self) -> QlogSink { - #[cfg(feature = "qlog")] - return self.qlog.clone().into(); - #[cfg(not(feature = "qlog"))] - QlogSink::default() + self.qlog.clone().into() } } @@ -311,7 +306,6 @@ impl Default for Config { crypto_buffer_size: 16 * 1024, allow_spin: true, segmentation_offload: true, - #[cfg(feature = "qlog")] qlog: None, reset_stream_at: true, @@ -344,14 +338,13 @@ impl fmt::Debug for Config { crypto_buffer_size, allow_spin, segmentation_offload, - #[cfg(feature = "qlog")] qlog, reset_stream_at, #[cfg(test)] deterministic_packet_numbers: _, } = self; - let mut s = fmt.debug_struct("Config"); - s.field("limits", limits) + fmt.debug_struct("Config") + .field("limits", limits) .field("idle_timeout", idle_timeout) .field("handshake_timeout", handshake_timeout) .field("keep_alive", keep_alive) @@ -371,9 +364,8 @@ impl fmt::Debug for Config { .field("crypto_buffer_size", crypto_buffer_size) .field("allow_spin", allow_spin) .field("segmentation_offload", segmentation_offload) - .field("reset_stream_at", reset_stream_at); - #[cfg(feature = "qlog")] - s.field("qlog", &qlog.is_some()); - s.finish_non_exhaustive() + .field("reset_stream_at", reset_stream_at) + .field("qlog", &qlog.is_some()) + .finish_non_exhaustive() } } diff --git a/rs/moq-quic/src/connection/paths.rs b/rs/moq-quic/src/connection/paths.rs index 1a1a447f700..614591c5e46 100644 --- a/rs/moq-quic/src/connection/paths.rs +++ b/rs/moq-quic/src/connection/paths.rs @@ -8,7 +8,6 @@ use super::{ }; use crate::{Duration, Instant, TIMER_GRANULARITY, congestion, packet::SpaceId, transport}; -#[cfg(feature = "qlog")] use qlog::events::{ExData, quic::RecoveryMetricsUpdated}; /// An unanswered PATH_CHALLENGE @@ -66,7 +65,6 @@ pub(super) struct PathData { first_packet: Option, /// Snapshot of the qlog recovery metrics - #[cfg(feature = "qlog")] recovery_metrics: RecoveryMetrics, /// Tag uniquely identifying a path in a connection @@ -117,7 +115,6 @@ impl PathData { first_packet_after_rtt_sample: None, in_flight: InFlight::new(), first_packet: None, - #[cfg(feature = "qlog")] recovery_metrics: RecoveryMetrics::default(), generation, } @@ -137,7 +134,6 @@ impl PathData { first_packet_after_rtt_sample: prev.first_packet_after_rtt_sample, in_flight: InFlight::new(), first_packet: None, - #[cfg(feature = "qlog")] recovery_metrics: prev.recovery_metrics.clone(), generation, } @@ -191,7 +187,6 @@ impl PathData { true } - #[cfg(feature = "qlog")] pub(super) fn qlog_recovery_metrics(&mut self, pto_count: u32) -> Option { let controller_metrics = self.congestion.metrics(); @@ -223,7 +218,6 @@ impl PathData { /// Congestion metrics as described in [`recovery_metrics_updated`]. /// /// [`recovery_metrics_updated`]: https://datatracker.ietf.org/doc/html/draft-ietf-quic-qlog-quic-events.html#name-recovery_metrics_updated -#[cfg(feature = "qlog")] #[derive(Default, Clone, PartialEq)] #[non_exhaustive] struct RecoveryMetrics { @@ -239,7 +233,6 @@ struct RecoveryMetrics { pub pacing_rate: Option, } -#[cfg(feature = "qlog")] impl RecoveryMetrics { /// Retain only values that have been updated since the last snapshot. fn retain_updated(&self, previous: &Self) -> Self { diff --git a/rs/moq-quic/src/connection/qlog.rs b/rs/moq-quic/src/connection/qlog.rs index 68af182479a..91791851fb8 100644 --- a/rs/moq-quic/src/connection/qlog.rs +++ b/rs/moq-quic/src/connection/qlog.rs @@ -1,10 +1,6 @@ -#![allow(unused_variables, reason = "function bodies in this module are regularly cfg'd out")] - -#[cfg(feature = "qlog")] use std::sync::{Arc, Mutex}; use std::time::Duration; -#[cfg(feature = "qlog")] use qlog::{ events::{ Event, EventData, @@ -12,7 +8,6 @@ use qlog::{ }, streamer::QlogStreamer, }; -#[cfg(feature = "qlog")] use tracing::warn; use crate::{ @@ -22,7 +17,6 @@ use crate::{ }; /// Shareable handle to a single qlog output stream -#[cfg(feature = "qlog")] #[derive(Clone)] pub struct QlogStream { pub(crate) streamer: Arc>, @@ -31,7 +25,6 @@ pub struct QlogStream { pub(crate) start: Instant, } -#[cfg(feature = "qlog")] impl QlogStream { fn emit_event(&self, orig_rem_cid: ConnectionId, event: EventData, now: Instant) { // Milliseconds since the epoch, at the nanosecond precision the streamer is built with. @@ -46,10 +39,9 @@ impl QlogStream { } } -/// A [`QlogStream`] that may be either dynamically disabled or compiled out entirely +/// Where a connection sends qlog events, or nowhere when qlog is off #[derive(Clone, Default)] pub(crate) struct QlogSink { - #[cfg(feature = "qlog")] stream: Option, } @@ -61,18 +53,15 @@ impl QlogSink { now: Instant, orig_rem_cid: ConnectionId, ) { - #[cfg(feature = "qlog")] - { - let Some(stream) = self.stream.as_ref() else { - return; - }; + let Some(stream) = self.stream.as_ref() else { + return; + }; - let Some(metrics) = path.qlog_recovery_metrics(pto_count) else { - return; - }; + let Some(metrics) = path.qlog_recovery_metrics(pto_count) else { + return; + }; - stream.emit_event(orig_rem_cid, EventData::QuicMetricsUpdated(metrics), now); - } + stream.emit_event(orig_rem_cid, EventData::QuicMetricsUpdated(metrics), now); } pub(super) fn emit_packet_lost( @@ -84,29 +73,26 @@ impl QlogSink { now: Instant, orig_rem_cid: ConnectionId, ) { - #[cfg(feature = "qlog")] - { - let Some(stream) = self.stream.as_ref() else { - return; - }; - - let event = PacketLost { - header: Some(PacketHeader { - packet_number: Some(pn), - packet_type: packet_type(space), - length: Some(info.size), - ..Default::default() - }), - frames: None, - is_mtu_probe_packet: None, - trigger: Some(match now.saturating_duration_since(info.time_sent) >= loss_delay { - true => PacketLostTrigger::TimeThreshold, - false => PacketLostTrigger::ReorderingThreshold, - }), - }; - - stream.emit_event(orig_rem_cid, EventData::QuicPacketLost(event), now); - } + let Some(stream) = self.stream.as_ref() else { + return; + }; + + let event = PacketLost { + header: Some(PacketHeader { + packet_number: Some(pn), + packet_type: packet_type(space), + length: Some(info.size), + ..Default::default() + }), + frames: None, + is_mtu_probe_packet: None, + trigger: Some(match now.saturating_duration_since(info.time_sent) >= loss_delay { + true => PacketLostTrigger::TimeThreshold, + false => PacketLostTrigger::ReorderingThreshold, + }), + }; + + stream.emit_event(orig_rem_cid, EventData::QuicPacketLost(event), now); } pub(super) fn emit_packet_sent( @@ -117,55 +103,47 @@ impl QlogSink { now: Instant, orig_rem_cid: ConnectionId, ) { - #[cfg(feature = "qlog")] - { - let Some(stream) = self.stream.as_ref() else { - return; - }; - - let event = PacketSent { - header: PacketHeader { - packet_number: Some(pn), - packet_type: packet_type(space), - length: Some(len as u16), - ..Default::default() - }, + let Some(stream) = self.stream.as_ref() else { + return; + }; + + let event = PacketSent { + header: PacketHeader { + packet_number: Some(pn), + packet_type: packet_type(space), + length: Some(len as u16), ..Default::default() - }; + }, + ..Default::default() + }; - stream.emit_event(orig_rem_cid, EventData::QuicPacketSent(event), now); - } + stream.emit_event(orig_rem_cid, EventData::QuicPacketSent(event), now); } pub(super) fn emit_packet_received(&self, pn: u64, space: SpaceId, now: Instant, orig_rem_cid: ConnectionId) { - #[cfg(feature = "qlog")] - { - let Some(stream) = self.stream.as_ref() else { - return; - }; - - let event = PacketReceived { - header: PacketHeader { - packet_number: Some(pn), - packet_type: packet_type(space), - ..Default::default() - }, + let Some(stream) = self.stream.as_ref() else { + return; + }; + + let event = PacketReceived { + header: PacketHeader { + packet_number: Some(pn), + packet_type: packet_type(space), ..Default::default() - }; + }, + ..Default::default() + }; - stream.emit_event(orig_rem_cid, EventData::QuicPacketReceived(event), now); - } + stream.emit_event(orig_rem_cid, EventData::QuicPacketReceived(event), now); } } -#[cfg(feature = "qlog")] impl From> for QlogSink { fn from(stream: Option) -> Self { Self { stream } } } -#[cfg(feature = "qlog")] fn packet_type(space: SpaceId) -> PacketType { match space { SpaceId::Initial => PacketType::Initial, diff --git a/rs/moq-quic/src/tests/mod.rs b/rs/moq-quic/src/tests/mod.rs index 34a489f3c66..36e50aa9eab 100644 --- a/rs/moq-quic/src/tests/mod.rs +++ b/rs/moq-quic/src/tests/mod.rs @@ -6207,7 +6207,6 @@ fn application_close_in_initial_is_rejected() { ); } -#[cfg(feature = "qlog")] #[test] fn qlog_packet_lost_trigger() { use qlog::events::{EventData, quic::PacketLostTrigger}; @@ -6269,7 +6268,6 @@ fn qlog_packet_lost_trigger() { ); } -#[cfg(feature = "qlog")] #[test] fn qlog_pacing_rate_is_bits_per_second() { use qlog::events::EventData; diff --git a/rs/moq-quic/src/tests/util.rs b/rs/moq-quic/src/tests/util.rs index fd7223cb960..376ce8313fa 100644 --- a/rs/moq-quic/src/tests/util.rs +++ b/rs/moq-quic/src/tests/util.rs @@ -738,11 +738,9 @@ impl Write for TestWriter { } /// A writer whose output can be read back, e.g. to inspect a qlog trace -#[cfg(feature = "qlog")] #[derive(Clone, Default)] pub(super) struct SharedBuffer(pub(super) Arc>>); -#[cfg(feature = "qlog")] impl Write for SharedBuffer { fn write(&mut self, buf: &[u8]) -> io::Result { self.0.lock().unwrap().extend_from_slice(buf); diff --git a/rs/moq-relay/Cargo.toml b/rs/moq-relay/Cargo.toml index d1d6834d33d..cfb42f3c4f9 100644 --- a/rs/moq-relay/Cargo.toml +++ b/rs/moq-relay/Cargo.toml @@ -41,10 +41,6 @@ doc = false # them on a simulated QUIC host. test-support = ["kio/sim", "moq-tokio/sim"] jemalloc = ["moq-tokio/jemalloc"] -# qlog trace capture (`--quic-qlog `). Off by default: it compiles the -# qlog machinery into both QUIC runtimes and is only wanted for debugging or -# congestion-control testing. -qlog = ["moq-tokio/qlog", "moq-uring/qlog"] [dependencies] anyhow = { workspace = true, features = ["backtrace"] } diff --git a/rs/moq-relay/src/uring.rs b/rs/moq-relay/src/uring.rs index d75c2c0707a..842f4325c51 100644 --- a/rs/moq-relay/src/uring.rs +++ b/rs/moq-relay/src/uring.rs @@ -477,14 +477,6 @@ impl std::fmt::Debug for Workers { /// One qlog sink is built for the whole group and cloned into every worker, so /// the traces share a single writer thread however many workers there are. fn transport(quic: &moq_tokio::quic::Resolved) -> anyhow::Result { - // The tokio path reports this through `moq_tokio::Error::QlogUnsupported`, - // which nothing builds here: this listener is the io_uring stack. - #[cfg(not(feature = "qlog"))] - anyhow::ensure!( - quic.qlog.is_none(), - "qlog capture requires a build with the 'qlog' feature; drop quic.qlog" - ); - // Mirrors `moq_tokio::Error::ReceiveWindowTooSmall`: incomplete messages hold // connection credit, so a window that cannot fit the largest one stalls. anyhow::ensure!( @@ -495,7 +487,6 @@ fn transport(quic: &moq_tokio::quic::Resolved) -> anyhow::Result`). Off by default so production -# builds do not pull in the qlog crate and its serde_json encoder. -qlog = ["moq-quic/qlog"] jemalloc = ["dep:tikv-jemallocator", "dep:tikv-jemalloc-ctl"] # Inside `kio::clock::sim::run`, detached tasks spawn on kio's deterministic simulator, # `quic::driver::sim` carries datagrams over seeded, impaired `moq_quic::sim::Link`s with diff --git a/rs/moq-tokio/src/error.rs b/rs/moq-tokio/src/error.rs index 0e03826b4b4..9cfacddb6af 100644 --- a/rs/moq-tokio/src/error.rs +++ b/rs/moq-tokio/src/error.rs @@ -83,10 +83,6 @@ pub enum Error { #[error("{0}")] NoBackend(&'static str), - /// A qlog directory was configured but this build can't capture traces. - #[error("qlog capture requires the 'qlog' feature")] - QlogUnsupported, - /// Key logging was enabled without a destination, including a boolean binding's missing env path. #[error("quic.keylog needs a nonempty path; boolean keylog settings require SSLKEYLOGFILE")] KeylogUnset, diff --git a/rs/moq-tokio/src/lib.rs b/rs/moq-tokio/src/lib.rs index 344af51f460..f2a32402033 100644 --- a/rs/moq-tokio/src/lib.rs +++ b/rs/moq-tokio/src/lib.rs @@ -90,11 +90,3 @@ pub use error::{Error, Result}; pub use log::{Log, RedactedUrl}; pub use server::{Listener, Server}; pub use transport::Transport; - -/// Whether this build can capture qlog traces, which the `qlog` feature gates. -/// -/// Setting a qlog directory without it is an error at dial time, so a caller offering -/// the knob should check here rather than surfacing an option that cannot work. -pub fn qlog_supported() -> bool { - cfg!(feature = "qlog") -} diff --git a/rs/moq-tokio/src/quic.rs b/rs/moq-tokio/src/quic.rs index 49b7b63af57..24107640d67 100644 --- a/rs/moq-tokio/src/quic.rs +++ b/rs/moq-tokio/src/quic.rs @@ -295,8 +295,6 @@ pub struct Config { /// Write qlog traces into this directory, which must already exist. /// /// Each endpoint writes one file, shared by its connections. - /// - /// Requires the `qlog` feature; setting it errors at init otherwise. #[serde(default, skip_serializing_if = "Option::is_none")] #[usage(name = "quic-qlog", long = "quic-qlog", env = "MOQ_QUIC_QLOG", setting = "quic.qlog")] #[usage(value_hint = usage_rs::ValueHint::DirPath)] @@ -553,12 +551,6 @@ impl Config { if self.keylog.as_ref().is_some_and(|path| path.as_os_str().is_empty()) { return Err(crate::Error::KeylogUnset); } - // Erroring beats silently ignoring the flag: the operator asked for traces and - // would otherwise go looking for files that were never going to appear. - match self.qlog.as_ref() { - Some(_) if cfg!(not(feature = "qlog")) => Err(crate::Error::QlogUnsupported), - _ => Ok(()), - }?; self.validate_limits() } @@ -701,9 +693,6 @@ impl Resolved { } /// The directory to write qlog traces into, if any. - /// - /// Only meaningful once [`Config::validate`] has passed; a build without the - /// `qlog` feature never gets here with a directory set. pub(crate) fn qlog_dir(&self) -> Option<&std::path::Path> { self.qlog.as_deref() } @@ -899,25 +888,6 @@ mod tests { assert!(reported.contains("--quic-qlog / MOQ_QUIC_QLOG"), "{reported}"); } - /// A build that can't capture must reject the flag rather than ignore it, so an - /// operator isn't left waiting on trace files that will never appear. - #[test] - fn qlog_requires_the_feature() { - let unset = Config::default().validate(); - assert!(unset.is_ok(), "no directory configured is always fine"); - - let set = Config { - qlog: Some("/tmp/qlog".into()), - ..Default::default() - }; - - if cfg!(feature = "qlog") { - assert!(set.validate().is_ok()); - } else { - assert!(matches!(set.validate(), Err(crate::Error::QlogUnsupported))); - } - } - /// The backends convert this duration with an infallible-by-panic `expect`, and the /// value arrives from a TOML file or a C caller, so validation has to catch it here. #[test] diff --git a/rs/moq-tokio/src/quic/backend.rs b/rs/moq-tokio/src/quic/backend.rs index b10f2988ddd..7112ef0dcb0 100644 --- a/rs/moq-tokio/src/quic/backend.rs +++ b/rs/moq-tokio/src/quic/backend.rs @@ -40,34 +40,26 @@ fn transport(quic: &Resolved, role: &str) -> Result { /// A [`driver::transport::qlog::Stream`] is a shared handle: every connection on the endpoint /// writes into it, tagged with its own qlog `group_id`, so this is one file per endpoint. fn apply_qlog(transport: &mut driver::transport::Config, quic: &Resolved, role: &str) -> Result<()> { - // `Client::validate` already rejected a directory this build can't honor, so the - // block below is only reached where capture actually works. let Some(dir) = quic.qlog_dir() else { return Ok(()); }; - #[cfg(feature = "qlog")] - { - // The pid and sequence keep endpoints sharing a directory from clobbering each other. - static SEQ: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); - let seq = SEQ.fetch_add(1, std::sync::atomic::Ordering::Relaxed); - let path = dir.join(format!("moq-{role}-{}-{seq}.sqlog", std::process::id())); - let file = std::fs::File::create(&path).map_err(Error::CreateQlog)?; - - // Deliberately unbuffered: qlog's streamer only flushes on `finish_log`, which is - // never called per event, so a BufWriter would hold every trace in memory until the - // endpoint drops and lose the lot if the process is killed. Killing a stuck process - // is exactly when these traces are worth having. - let mut config = driver::transport::qlog::Config::default(); - config.writer = Some(Box::new(file)); - config.title = Some(format!("moq-tokio {role}")); - - transport.qlog = config.into_stream(); - tracing::info!(path = %path.display(), "writing qlog"); - } + // The pid and sequence keep endpoints sharing a directory from clobbering each other. + static SEQ: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); + let seq = SEQ.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + let path = dir.join(format!("moq-{role}-{}-{seq}.sqlog", std::process::id())); + let file = std::fs::File::create(&path).map_err(Error::CreateQlog)?; + + // Deliberately unbuffered: qlog's streamer only flushes on `finish_log`, which is + // never called per event, so a BufWriter would hold every trace in memory until the + // endpoint drops and lose the lot if the process is killed. Killing a stuck process + // is exactly when these traces are worth having. + let mut config = driver::transport::qlog::Config::default(); + config.writer = Some(Box::new(file)); + config.title = Some(format!("moq-tokio {role}")); - #[cfg(not(feature = "qlog"))] - let _ = (transport, dir, role); + transport.qlog = config.into_stream(); + tracing::info!(path = %path.display(), "writing qlog"); Ok(()) } @@ -108,7 +100,6 @@ pub enum Error { UnsupportedCpu(#[from] crate::crypto::UnsupportedCpu), /// The qlog trace file couldn't be created, usually a missing directory. - #[cfg(feature = "qlog")] #[error("failed to create qlog file")] CreateQlog(#[source] std::io::Error), diff --git a/rs/moq-tokio/tests/integration/backend.rs b/rs/moq-tokio/tests/integration/backend.rs index 1ae7ed34820..03954f49bf4 100644 --- a/rs/moq-tokio/tests/integration/backend.rs +++ b/rs/moq-tokio/tests/integration/backend.rs @@ -1050,7 +1050,6 @@ async fn quic_cert_reload() { /// /// Both ends write into one directory, so this covers the client and server paths /// at once. Each endpoint writes one file. -#[cfg(feature = "qlog")] async fn qlog_test(scheme: &str) -> Vec { let dir = tempfile::tempdir().expect("failed to create tempdir"); @@ -1103,7 +1102,6 @@ async fn qlog_test(scheme: &str) -> Vec { traces } -#[cfg(feature = "qlog")] #[tokio::test] async fn quic_qlog() { let traces = qlog_test("moqt").await; diff --git a/rs/moq-uring/Cargo.toml b/rs/moq-uring/Cargo.toml index cf980f733b5..ae02b54a308 100644 --- a/rs/moq-uring/Cargo.toml +++ b/rs/moq-uring/Cargo.toml @@ -22,10 +22,6 @@ doc = false default = ["quic"] # QUIC and WebTransport on moq-quic, with TLS through rustls. quic = ["dep:moq-congestion", "dep:moq-crypto", "dep:moq-quic", "dep:rustls"] -# Capture qlog traces (`quic::Transport::qlog`). Off by default: it compiles the -# qlog crate and its serde_json encoder into moq-quic, which a production build has -# no use for. -qlog = ["moq-quic?/qlog"] # Workers created inside a tokio runtime with a `kio::clock::Manual` clock installed # run on that clock, so a test decides when their time passes. For test builds. _manual = ["kio/manual"] diff --git a/rs/moq-uring/README.md b/rs/moq-uring/README.md index c87490ca67f..6d9428746fc 100644 --- a/rs/moq-uring/README.md +++ b/rs/moq-uring/README.md @@ -47,8 +47,7 @@ local (`!Send`) task set, and the UDP sockets bound through it. `quic::Transport::qlog` turns capture on. The pinned worker never writes to the file: the QUIC stacks want a `Send + Sync` writer, which cannot hold the worker's `!Send` ring handle, so a trace is staged in memory and handed to - one background thread for every worker sharing the sink. Behind the `qlog` - feature, so a production build compiles none of it. + one background thread for every worker sharing the sink. - **Metrics**: a set of relaxed atomic counters per worker, read from any thread through `metrics::Metrics::snapshot`. Buffer-pool health (`ENOBUFS`, provided-buffer exhaustion, TX-pool stalls), batch effectiveness (datagrams @@ -95,8 +94,8 @@ just rs uring `moq-relay` always builds it on Linux and serves from it with `--runtime-io-uring`. -The `qlog` feature turns on moq-quic's capture support. It writes one file per -endpoint on the accept side and per dial on the connect side. +qlog capture writes one file per endpoint on the accept side and per dial on +the connect side. ## Validation diff --git a/rs/moq-uring/src/quic/driver/mod.rs b/rs/moq-uring/src/quic/driver/mod.rs index 67cde5f075c..8a09bbd444e 100644 --- a/rs/moq-uring/src/quic/driver/mod.rs +++ b/rs/moq-uring/src/quic/driver/mod.rs @@ -21,7 +21,6 @@ pub(crate) use connection::Shared; use std::{num::NonZeroU64, sync::Arc}; -#[cfg(feature = "qlog")] use super::qlog; use super::{Error, client, server, transport}; use crate::udp; @@ -117,7 +116,6 @@ pub(crate) fn endpoint_config( pub(crate) fn client_config(config: &client::Config) -> Result { let mut client = moq_quic::client::Config::new(config.tls.clone()); client.transport = transport_config(&config.transport)?; - #[cfg(feature = "qlog")] with_qlog(&mut client.transport, &config.transport, qlog::Side::Client); Ok(client) } @@ -127,7 +125,6 @@ pub(crate) fn server_config(config: &server::Config) -> Result Result, } @@ -69,7 +64,6 @@ impl Default for Config { congestion: Congestion::Delay.into(), keep_alive: None, mtu_discovery: false, - #[cfg(feature = "qlog")] qlog: None, } } @@ -86,7 +80,6 @@ impl std::fmt::Debug for Config { .field("congestion", &format_args!("..")) .field("keep_alive", &self.keep_alive) .field("mtu_discovery", &self.mtu_discovery); - #[cfg(feature = "qlog")] debug.field("qlog", &self.qlog); debug.finish() } diff --git a/rs/moq-uring/tests/integration/qlog.rs b/rs/moq-uring/tests/integration/qlog.rs index 680ce500b6f..4bb0d102c7a 100644 --- a/rs/moq-uring/tests/integration/qlog.rs +++ b/rs/moq-uring/tests/integration/qlog.rs @@ -7,7 +7,7 @@ //! //! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. -#![cfg(all(feature = "qlog", feature = "quic"))] +#![cfg(feature = "quic")] use crate::support; diff --git a/sh/obs/check.sh b/sh/obs/check.sh index 50267c6623e..f64d2326259 100755 --- a/sh/obs/check.sh +++ b/sh/obs/check.sh @@ -65,22 +65,6 @@ if command -v cmake >/dev/null; then cat "$build_dir/configure.log" >&2 exit 1 fi - # Neither a release archive nor a prebuilt moq-ffi carries qlog. - for scenario in archive prebuilt; do - args=(-DMOQ_FFI_QLOG=ON) - case "$scenario" in - archive) args+=(-DMOQ_LOCAL= -DMOQ_VERSION=0.0.0) ;; - prebuilt) args+=("-DMOQ_FFI_DIR=$build_dir") ;; - esac - if cmake -S . -B "$build_dir/qlog-$scenario" "${args[@]}" >"$build_dir/configure.log" 2>&1; then - echo "CMake accepted MOQ_FFI_QLOG without a source build: $scenario" >&2 - exit 1 - fi - if ! grep -Fq "MOQ_FFI_QLOG requires the in-tree build" "$build_dir/configure.log"; then - cat "$build_dir/configure.log" >&2 - exit 1 - fi - done archive="$build_dir/moq-cpp-0.0.0-x86_64-unknown-linux-gnu.tar.gz" touch "$archive" for scenario in conflict missing mismatch; do diff --git a/sh/obs/moq.sh b/sh/obs/moq.sh index c6568a117ec..cfc7e7f8c20 100755 --- a/sh/obs/moq.sh +++ b/sh/obs/moq.sh @@ -8,8 +8,6 @@ # Debug, for the same reason `just obs ci` is: the Rust cache CI restores holds # dev-profile artifacts. It shares `just cpp check`'s package build, so a run of # both configures it once. -# -# `moq.sh qlog` builds it with MOQ_FFI_QLOG instead, into a build and prefix of its own. set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/../../cpp/moq" @@ -18,20 +16,10 @@ if ! command -v uniffi-bindgen-cpp >/dev/null 2>&1; then echo "uniffi-bindgen-cpp not on PATH; run inside 'nix develop', which supplies it" >&2 exit 1 fi -variant=${1:-} -qlog=OFF -case "$variant" in - "") ;; - qlog) qlog=ON ;; - *) - echo "usage: $0 [qlog]" >&2 - exit 1 - ;; -esac -build="$PWD/build/package${variant:+-$variant}" -prefix="$PWD/build/prefix${variant:+-$variant}" +build="$PWD/build/package" +prefix="$PWD/build/prefix" { - cmake -S . -B "$build" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_LIBDIR=lib -DMOQ_FFI_DIR= -DMOQ_FFI_QLOG="$qlog" + cmake -S . -B "$build" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_LIBDIR=lib -DMOQ_FFI_DIR= cmake --build "$build" --config Release cmake --install "$build" --config Release --prefix "$prefix" } >&2 diff --git a/sh/obs/qlog.sh b/sh/obs/qlog.sh deleted file mode 100755 index d120bf7ca00..00000000000 --- a/sh/obs/qlog.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -# Build the in-tree C++ package with MOQ_FFI_QLOG, which an OBS build passes to -# show the qlog directory setting, and check that moq-ffi reports qlog support. -set -euo pipefail - -if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then - exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" -fi - -here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) - -moq_prefix=$("$here/moq.sh" qlog) -moq_pc="$moq_prefix/lib/pkgconfig/moq-cpp.pc" -# Assigned first: set -e ignores a failing substitution inside a command's arguments. -moq_sources=$(pkg-config --variable=sources "$moq_pc") -moq_flags=$(pkg-config --cflags --libs "$moq_pc") - -out=$(mktemp -d) -trap 'rm -rf "$out"' EXIT - -printf '#include \nint main() { return moq::qlog_supported() ? 0 : 1; }\n' >"$out/qlog.cpp" -# shellcheck disable=SC2086 # moq_flags is a flag list. -"${CXX:-c++}" -std=c++17 -pthread -o "$out/qlog" "$out/qlog.cpp" "$moq_sources" $moq_flags -if ! "$out/qlog"; then - echo "MOQ_FFI_QLOG=ON built moq-ffi without qlog support" >&2 - exit 1 -fi -echo "moq::qlog_supported(): ok" diff --git a/swift/Sources/Moq/Client.swift b/swift/Sources/Moq/Client.swift index 733d3fb5d45..eb3735c0540 100644 --- a/swift/Sources/Moq/Client.swift +++ b/swift/Sources/Moq/Client.swift @@ -84,11 +84,6 @@ public func versions() -> [String] { moqVersions() } -/// Whether this build can write qlog traces for `QuicConfig.qlog`. -public func qlogSupported() -> Bool { - moqQlogSupported() -} - /// A MoQ session, including its initial native dial. public final class Session: Sendable { let ffi: MoqSession