Skip to content

librtmp2-server 0.8.0

Choose a tag to compare

@github-actions github-actions released this 21 Nov 23:18

Security

  • A cluster snapshot seek is bounded to the bytes already received for every
    SeekFrom variant. A small authenticated frame with a far chunk offset made
    the snapshot writer reserve that many bytes and abort the process; a
    legitimate retry may still rewind.
  • Bearer tokens are compared with the full length difference. ct_str_eq
    truncated the length XOR to a byte, so a token 256 bytes longer could
    compare equal to a shorter NUL-filled candidate.

Fixed

  • An ambiguous cluster CreateStream that was dispatched but not confirmed
    returns 503 with CLUSTER_WRITE_UNKNOWN (or CLUSTER_TIMEOUT for an actual
    timeout) instead of a definite 500. The stream and its generated keys may
    have committed; the message asks for the same stream ID and any supplied
    keys before assuming success.
  • A forwarded cluster write now shares one deadline across its connect, auth,
    send and response phases. The local Raft attempt is bounded separately, so a
    connect/auth expiry is undispatched and cannot be mistaken for a dispatched
    write by an outer timer. A pre-send timeout still returns 503
    CLUSTER_TIMEOUT with a safe-to-retry message; the local Raft attempt and
    the post-send phases stay ambiguous.
  • mask_api_token masks by characters instead of byte slicing, so a stored
    non-ASCII token no longer panics startup.
  • A release or player retirement that races a queued PersistPlay settles the
    fast-play viewer slot exactly once: a row inserted after the release is
    retired, a failed post-insert deactivation is queued for retry, and the
    active player counts are rebuilt after a batch panic rollback and after a
    cascade stream delete.
  • Resync publishes player counts under the same active-before-pending lock
    order as the reserve path, so a concurrent reserve/cancel cannot lose an
    increment and the inverted order can no longer deadlock.
  • IPv6 rate-limit buckets are keyed by /64, so addresses in one /64 share a
    bucket. A host controlling a /48 can still use many /64 buckets and may
    evict other clients' buckets once the tracking cap is reached. A panicking
    Db::batch transaction is
    rolled back instead of leaving BEGIN IMMEDIATE open, a player_update
    read error fails closed without reserving a slot, and a player-list read
    fault answers 500 instead of a false last-key 400.
  • A dual-role connection whose publisher row vanished (cluster heal or delete
    drain) is closed instead of having its media re-attributed to the stream it
    plays. Phantom publisher and player roles are cleared with their in-memory
    slots, and relay state is dropped before such a kick.

Changed

  • Package version 0.7.0 → 0.8.0. SnapshotBuf is public, so this is a
    minor bump under the crate's pre-1.0 rules.
  • Built on librtmp2 0.17.2.
  • The CI benchmark sweep compares against MediaMTX v1.21.4 (was v1.21.3).
  • Dependency updates: rusqlite 0.43 (bundled SQLite), OpenRaft 0.10.1
    (openraft and openraft-legacy) and clap 4.6.9.

What's Changed

  • chore(deps): update sonarsource/sonarqube-scan-action action to v8.5.0 by @renovate[bot] in #374
  • chore(deps): update taiki-e/install-action action to v2.90.4 by @renovate[bot] in #376
  • fix(cluster): bound snapshot chunk offsets to received bytes by @AlexanderWagnerDev in #375
  • chore(deps): update dtolnay/rust-toolchain digest to 3900882 by @renovate[bot] in #377
  • chore(deps): update taiki-e/install-action action to v2.90.5 by @renovate[bot] in #378
  • fix(deps): update rust crate rusqlite to 0.43 by @renovate[bot] in #379
  • ci: bump MediaMTX to v1.21.4 by @AlexanderWagnerDev in #381
  • chore(deps): update rust crate clap to v4.6.8 by @renovate[bot] in #383
  • fix(server): harden abandoned-publisher routing and bearer length check by @AlexanderWagnerDev in #382
  • chore(deps): update rust crate uuid to v1.29.3 - abandoned by @renovate[bot] in #384
  • chore(deps): update rust crate bytes to v1.12.2 by @renovate[bot] in #385
  • chore(deps): update taiki-e/install-action action to v2.90.6 by @renovate[bot] in #386
  • fix(server): harden rate limiting, player roles, and DB transactions by @AlexanderWagnerDev in #387
  • fix(deps): update rust crate openraft to v0.10.1 by @renovate[bot] in #389
  • chore(deps): update rust crate clap to v4.6.9 by @renovate[bot] in #388
  • fix(deps): update rust crate openraft-legacy to v0.10.1 by @renovate[bot] in #390
  • chore(deps): update taiki-e/install-action action to v2.90.7 by @renovate[bot] in #392
  • fix(server): classify ambiguous creates and mask non-ASCII tokens by @AlexanderWagnerDev in #391
  • chore(deps): update taiki-e/install-action action to v2.90.8 by @renovate[bot] in #393
  • Release 0.8.0 by @AlexanderWagnerDev in #394

Full Changelog: v0.7.0...v0.8.0

Benchmarks

Measured automatically for this release on a CI runner; the machine is described below. Raw data: bench-results-v0.8.0.json.

  • Measured: 2026-11-21 23:30:44 UTC · 8747918 · crate version 0.8.0 · workflow run
  • Built on: librtmp2 0.17.2
  • CPU: AMD EPYC 9V74 80-Core Processor · 4 vCPUs
  • RAM: 15.6 GiB
  • System: Linux 7.0.0-1020-azure x86_64 · rustc 1.100.0 · GitHub-hosted ubuntu26 (image 20261116.202.1)
  • Noise: shared CI VM — CPU model, neighbouring load and the runner image change between runs, so treat absolute numbers as indicative.
  • Comparable vs release v0.7.0: ❌ different hardware (AMD EPYC 7763 64-Core Processor, 4 vCPUs vs AMD EPYC 9V74 80-Core Processor, 4 vCPUs): only large changes (> 25 %) mean anything

http_api

Benchmark Time Throughput vs release v0.7.0
http_api/create_stream 211.59 µs — ⚪ −25.0 %
http_api/health 111.55 µs — ⚪ −29.1 %
http_api/list_streams 8.4 ms — ⚪ −25.2 %

🟢 faster · 🔴 slower · ⚪ within the noise band (5–25 % depending on how comparable the two environments are, plus both runs' Criterion confidence intervals). Lower time is better.

Cross-server sweep

Same RTMP client and ffmpeg source for every server, one server at a time: load viewers 500 1000 2000, publisher ffmpeg 1280x720@30 H.264 2.5 Mbps + AAC 128 kbps. One sweep per run, no repetitions — the shared runner makes single values noisy, so compare servers within this run rather than across runs.

Servers: librtmp2-server 0.8.0 (librtmp2 0.17.2) · MediaMTX v1.21.4 · nginx-rtmp nginx 1.31.8 (nginx-rtmp-module @ 6c7719d)

librtmp2-server vs the baselines
Metric Now vs release v0.7.0
publish handshakes/s 9,442 🟢 +48.4 %
publish handshake avg (ms) 2.58 🟢 −29.9 %
publish handshake p95 (ms) 4.40 🟢 −43.2 %
play handshakes/s 7,344 ⚪ +15.0 %
play handshake avg (ms) 2.91 ⚪ −18.5 %
play handshake p95 (ms) 5.55 ⚪ −8.0 %
join, 1 viewer: avg (ms) 0.48 ⚪ −17.2 %
join, 1 viewer: p95 (ms) 0.48 ⚪ −17.2 %
join, 25 viewers: avg (ms) 1.87 ⚪ +0.0 %
join, 25 viewers: p95 (ms) 2.56 🟢 −33.7 %
join, 100 viewers: avg (ms) 3.20 🟢 −45.8 %
join, 100 viewers: p95 (ms) 5.72 🟢 −55.5 %
load, 500 viewers: join avg (ms) 33.87 ⚪ −10.1 %
load, 500 viewers: join p95 (ms) 59.78 ⚪ −17.3 %
load, 500 viewers: frames/viewer 73.67 ⚪ +0.0 %
load, 500 viewers: CPU (% of one core) 29.10 ⚪ −20.7 %
load, 500 viewers: peak RSS (MiB) 24.20 ⚪ +1.3 %
load, 1000 viewers: join avg (ms) 22.99 🟢 −28.0 %
load, 1000 viewers: join p95 (ms) 52.44 🟢 −43.0 %
load, 1000 viewers: frames/viewer 73.66 ⚪ +0.0 %
load, 1000 viewers: CPU (% of one core) 57.90 ⚪ −20.4 %
load, 1000 viewers: peak RSS (MiB) 33.60 ⚪ −1.2 %
load, 2000 viewers: join avg (ms) 57.01 🟢 −50.7 %
load, 2000 viewers: join p95 (ms) 175.5 🟢 −41.0 %
load, 2000 viewers: frames/viewer 73.63 ⚪ −0.0 %
load, 2000 viewers: CPU (% of one core) 116.4 ⚪ −10.0 %
load, 2000 viewers: peak RSS (MiB) 53.80 ⚪ −0.2 %
Handshake latency
Server publish /s avg ms p95 p99 play /s avg ms p95 p99
librtmp2-server 9,442 2.58 4.40 5.37 7,344 2.91 5.55 6.87
MediaMTX 6,619 3.95 6.56 7.11 5,741 4.02 6.49 9.33
nginx-rtmp 702.2 41.64 42.80 43.53 357.3 83.18 85.38 87.20
Join latency (avg / p95 ms)
Server 1 viewer 25 viewers 100 viewers
librtmp2-server 0.48 / 0.48 1.87 / 2.56 3.20 / 5.72
MediaMTX 0.71 / 0.71 3.84 / 5.16 12.34 / 18.35
nginx-rtmp 81.68 / 81.68 83.04 / 84.05 85.70 / 88.69
Many viewers on one stream
Viewers Server join avg / p95 ms CPU % (one core) peak RSS MiB frames/viewer
500 librtmp2-server 33.87 / 59.78 29.10 24.20 73.67
500 MediaMTX 31.34 / 51.95 79.00 95.50 73.60
500 nginx-rtmp 101.6 / 116.2 42.20 21.50 73.57
1000 librtmp2-server 22.99 / 52.44 57.90 33.60 73.66
1000 MediaMTX 61.56 / 103.8 159.1 142.1 73.59
1000 nginx-rtmp 183.2 / 207.0 85.60 27.60 73.62
2000 librtmp2-server 57.01 / 175.5 116.4 53.80 73.63
2000 MediaMTX 184.2 / 481.8 195.2 313.6 58.22

A competitor delivering fewer frames per viewer than the others was overloaded at that step (the delivered rate, not just latency, is the result).