Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions quest/m0/test-flakes-3/interop-finish-unroutable.md

This file was deleted.

20 changes: 20 additions & 0 deletions quest/m0/test-flakes-3/py-finish-publisher-ack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# [S] The python finish publisher acknowledges every run

## Goal

`just test interop --all --finish` passes its `python -> *` row: the python
publisher prints `finish acknowledged` once the harness writes `complete`.

## Plan

Seen once on 2026-11-17 while validating
[moq-dev/moq#9052](https://github.com/moq-dev/moq/pull/9052): every reader of the
python publisher passed (`health=ok`), the relay refused nothing, yet the
publisher (`test/interop/clients/python/interop.py`, the `finish_ack` branch)
printed nothing after `finish ready linger_us=` and its session stayed open
until the harness reaped it about two minutes later. A rerun of the row passed.
So it hung after announcing `<broadcast>.health`: in `acknowledge()` reading
the ack FIFO, or in `client.session.state()`. Trace which, under load, and fix
that cause rather than the harness timeout.

Public API: none. Wire: none.
17 changes: 14 additions & 3 deletions rs/moq-net/src/lite/publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ impl Shared {
/// the node `node` that claims it: this node's own when it serves the claim itself,
/// else the claim it follows to `node`. `None` when nothing reaches that node or the
/// way would lead back to the peer. A request naming no node resolves through any
/// route. Waits while the session the request would leave on has yet to serve the claim.
/// route. Waits while the session the request would leave on has yet to serve the claim,
/// whether or not the request names a node.
fn poll_node_filter(
&self,
origin: origin::Consumer,
Expand All @@ -193,14 +194,24 @@ impl Shared {
node: Option<crate::route::NodeId>,
waiter: &kio::Waiter,
) -> Poll<Option<origin::Consumer>> {
let claim = origin.resolve(broadcast).zip(instance.cloned());
let Some(node) = node else {
// The node shows a peer's claim to the sessions it reaches before the session
// serving it lands its route in the origin, each on its own task. A peer that
// asks the moment it hears must find that route, not an origin without one.
if let Some(claim) = claim {
let _ = ready!(
origin
.route_node()
.poll_forward(self.peer_setup.tag(), None, &claim, waiter)
);
}
return Poll::Ready(Some(origin));
};
// A node is named for the claim of one instance.
let (Some(path), Some(instance)) = (origin.resolve(broadcast), instance) else {
let Some(claim) = claim else {
return Poll::Ready(None);
};
let claim = (path, instance.clone());
let via = ready!(
origin
.route_node()
Expand Down
68 changes: 68 additions & 0 deletions rs/moq-net/src/lite/subscriber/routed/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,3 +512,71 @@ async fn an_unresolved_claim_outlives_another_prefixs_removal() {
let ended = routed.receive(Wire::End { id: 2, lost: false });
assert!(matches!(ended, Err(Error::ProtocolViolation)), "{ended:?}");
}

/// The node shows a peer's claim to the sessions it reaches before the session serving it
/// lands its route in the origin, each on its own task. A reader asking for the claim the
/// moment it hears of it waits for that route, and is not refused for want of it.
#[kio::test]
async fn a_request_for_a_claim_shown_waits_for_its_route() {
use crate::model::ProduceTest;
const TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10);
let version = crate::Version::lite(crate::lite::Version::Lite07);
let (subscriber, _consumer) = forwarding();
let mut upstream = asking(&subscriber, &Permit::default());

// A reader on lite-07, served from the relay's origin.
let reader = crate::origin::Config::new(std::num::NonZeroU64::new(3).unwrap()).produce();
let (client, server) = crate::transport::memory::pair(crate::transport::memory::Config {
protocol: Some(version.alpn().to_string()),
..Default::default()
});
let dial = crate::Client::new()
.with_versions(version.into())
.with_subscriber(reader.clone());
let serve = crate::Server::new()
.with_versions(version.into())
.with_publisher(subscriber.origin.consume());
let (_client, _server) = futures::join!(
async {
let (session, driver) = dial.connect(kio::clock::now(), client).await.unwrap();
drop(kio::clock::sim::spawn(crate::time::run(driver)));
session
},
async {
let (session, driver) = serve.accept(kio::clock::now(), server).await.unwrap();
drop(kio::clock::sim::spawn(crate::time::run(driver)));
session
},
);

// The claim reaches the node, which shows it to the reader, while the session it
// arrived on has yet to land its route.
upstream.receive(start("live")).unwrap();
upstream.flush();
let live = kio::clock::timeout(TIMEOUT, reader.consume().follow("live", None).unwrap().available())
.await
.expect("the reader hears of the claim")
.unwrap()
.expect("the claim is shown");
// It asks at once, and its request reaches the relay before the route does.
let _subscribing = kio::clock::sim::spawn(async move { live.track("video").unwrap().subscribe(None).await });
kio::clock::sleep(std::time::Duration::from_millis(100)).await;

// The route lands, and the request goes on to the session serving the claim. Refused
// instead, the reader would wait for a route change that never comes.
let stream = upstream.stream();
while let Some(output) = stream.try_serve() {
upstream.output(&subscriber, output);
}
let minted = kio::clock::timeout(
TIMEOUT,
kio::wait(|waiter| {
upstream.poll(&subscriber, waiter);
subscriber.sources.poll_pop(waiter)
}),
)
.await
.expect("the request reaches the claim")
.unwrap();
assert_eq!(minted.path.as_str(), "live");
}