Repository navigation
Description
Problem
catalog::Producer::new falls back to Clock::default() when Config carries no clock. Clock::new() then unwraps a fallible constructor, so a wall clock before the moq epoch (2020) panics. With panic = "abort" the panic aborts the whole host process instead of reaching the catch_unwind in the FFI layer.
At 6e97bd16d:
rs/moq-mux/src/catalog/producer.rs:364:config.clock.unwrap_or_default()runs on everyProducer::newwithout an explicit clock.rs/moq-mux/src/clock.rs:87:Clock::new()isSelf::arrival(Self::LEAD).expect("the current wall time is representable as a broadcast clock").rs/moq-mux/src/clock.rs:44:wall_clock()refuses any time before 2020 ("A time before 2020 cannot be named on the wire; refuse it rather than advertise 2020"), soarrival()returnsErrand theexpectpanics.rs/moq-c/src/ffi.rs:42: every FFI call is wrapped incatch_unwindand a panic maps toError::Panic, so the intent is that a library panic does not take the host down.Cargo.toml:255and:313: both[profile.dev]and[profile.release]setpanic = "abort", so thatcatch_unwindnever runs.- Both FFI entry points reach this path:
rs/moq-c/src/publish.rs:106andrs/moq-ffi/src/producer.rs:141.
An invalid wall clock is an ordinary state on embedded devices. Many boards have no battery-backed RTC, or one that was reset, so the wall clock stays at its default epoch until NTP or the network sets it. A publisher that starts at boot, before time sync, hits this path.
Measured behavior
On an Android (arm64) device with no valid time yet at boot, publishing started before time sync and the host app's process died with SIGABRT. The library was built from tag libmoq-v0.6.13.
- The tombstone's abort message is only a prefix from the host app, but the register dump holds the ASCII of the
expectmessage (the current wall...). - Symbolizing against the matching build (same Build ID) puts the abort frame inside the
moq_net::ietf::publisher::...::sync_namespaceclosure. Those frames are inlined, so I treat that location as approximate. The message string identifies the site: it appears atclock.rs:82of that tag. - Once the clock was set, the crash no longer reproduced.
Why a small fix is not obvious
Producer::newreturnsResult<Self, moq_net::Error>, which cannot carrymoq_mux::Error::UnmappableTimestamp. Changing the return type touches about 30 files underrs/.- Passing a pre-built clock from the FFI layer through
Config::with_clockis not equivalent:anchored = config.clock.is_some()becomestrue, which changes what quest(m1): plan the catalog root clock as the producer clock, and an exact wall_clock #5345 plans for the producer's clock.
Possible approaches
- Make
Producer::newreturnmoq_mux::Errorand build the default clock withClock::arrival(Clock::LEAD)?instead ofunwrap_or_default(). The FFI crates already convertmoq_mux::Error, so the failure reaches the caller as an error code. This is a breaking signature change. - Add a fallible
Clock::try_new()(keepingnew()asexpectfor callers that cannot fail) and validate the wall time inConfigbeforeProducer::new. Less churn at call sites, but the validation and the construction are two steps. - Keep the behavior and document that
Producer::newpanics on a pre-2020 clock. The FFI hosts would have to check the system time themselves.
Separately, with panic = "abort" the catch_unwind in ffi.rs does not run in any build, so it cannot turn a panic into Error::Panic. If abort is intentional for the FFI crates, that catch_unwind could be removed or documented
I can send a PR for (1) or (2). Since (1) is breaking, I'd like your call before opening it.
Related: #3675 introduced the catalog-root clock and the 2020 epoch.
(Written by Claude Opus 5.5)
Activity
kixelated commentedon Oct 13, 2026
lul okay I thought 2020 would be safe as an epoch, as a way of saving a few more bytes.
kixelated commentedon Oct 13, 2026
Thanks for the detailed report; confirmed on
main.Decision (planned in #5418):
Clock::new()stays infallible, and the catalog omits the rootclock, which is already optional on the wire. Media still publishes. A pre-2020 reading means the clock is unset. Omitting it beats advertising a false mapping: DASH falls back to the relay's anchor instead of a 1970availabilityStartTime.Producer::newkeeps its signature.Clock::wall()returnsOption, and anything that actually needs a wall errors.@moq/publishgets the same treatment. Tracked byquest/m0/wall-clock-omit.quest/m0/release-22/wall-clock-omit), which closes this issue.panic = "abort": we're switching the workspace to unwind, so a panic closes only its connection and FFI hosts getMOQ_ERROR_PANIC/ an exception instead of dying. Lock poison will be ignored at shared locks, and every spawned task will be supervised, so a long-lived task's panic still exits loudly rather than leaving a zombie. Tracked byquest/m0/panic-isolation.Once #5418 merges, anyone who wants to donate tokens can pick one up with
/quest-start quest/m0/wall-clock-omit(orquest/m0/panic-isolation). Your offer of a PR is welcome too, following the plan in the quest file.(Written by Claude Opus 5.5)
quest: import moq-dev#5407 and moq-dev#5413 (moq-dev#5418)