Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QoS parameters on queries #1107

Closed
DariusIMP opened this issue Jun 10, 2024 · 4 comments
Closed

QoS parameters on queries #1107

DariusIMP opened this issue Jun 10, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@DariusIMP
Copy link
Member

Describe the bug

On dev/1.0.0 branch, when doing a query operation, as well as when replying to the query, if we specify QoS parameters, those aren't properly loaded.

To reproduce

Take the z_get and the z_queryable examples.

I haven't reproduced this issue on Pub/Sub examples.

Query

Edit the z_get example to change the QoS parameters, for instance:

diff --git a/examples/examples/z_get.rs b/examples/examples/z_get.rs
index d4fc416f9..2d2bf16a0 100644
--- a/examples/examples/z_get.rs
+++ b/examples/examples/z_get.rs
@@ -37,7 +37,10 @@ async fn main() {
         .value(value)
         .target(target)
         .timeout(timeout)
-        .await
+        .congestion_control(zenoh::publisher::CongestionControl::Block)
+        .priority(zenoh::core::Priority::Background)
+        .express(true)
+        .await
         .unwrap();
     while let Ok(reply) = replies.recv_async().await {
         match reply.result() {

Run the example:

RUST_LOG=trace ./z_get -e tcp/localhost:7447 --no-multicast-scouting

And see the log, where the QoS parameters do not correspond to what we specified:

2024-06-10T11:22:51.648146Z TRACE net-0 ThreadId(11) zenoh_transport::unicast::universal::tx: Scheduled: NetworkMessage { body: OAM(Oam { id: 1, body: ZBuf(ZBuf { slices: [[02, 07, 00, 02, 10, c2, e6, 39, 8b, 0d, 2c, 44, 49, 24, ca, ae, 03, ab, 76, 27, b5, 02, 0d, 32, 74, 63, 70, 2f, 5b, 32, 61, 30, 32, 3a, 38, 34, 32, 38, 3a, 36, 31, 38, 37, 3a, 63, 37, 30, 31, 3a, 63, 61, 34, 3a, 36, 30, 63, 65, 3a, 32, 36, 61, 36, 3a, 65, 30, 38, 39, 5d, 3a, 35, 30, 36, 37, 37, 33, 74, 63, 70, 2f, 5b, 32, 61, 30, 32, 3a, 38, 34, 32, 38, 3a, 36, 31, 38, 37, 3a, 63, 37, 30, 31, 3a, 61, 63, 37, 31, 3a, 62, 63, 31, 38, 3a, 32, 32, 37, 33, 3a, 61, 35, 61, 63, 5d, 3a, 35, 30, 36, 37, 37, 13, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 31, 5d, 3a, 35, 30, 36, 37, 37, 25, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 61, 34, 33, 37, 3a, 36, 31, 66, 66, 3a, 66, 65, 66, 30, 3a, 31, 32, 38, 62, 5d, 3a, 35, 30, 36, 37, 37, 25, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 61, 34, 33, 37, 3a, 36, 31, 66, 66, 3a, 66, 65, 66, 30, 3a, 31, 32, 38, 61, 5d, 3a, 35, 30, 36, 37, 37, 25, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 62, 63, 33, 65, 3a, 35, 33, 66, 66, 3a, 66, 65, 38, 63, 3a, 36, 33, 36, 37, 5d, 3a, 35, 30, 36, 37, 37, 25, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 31, 63, 63, 66, 3a, 37, 37, 61, 33, 3a, 37, 37, 61, 30, 3a, 62, 65, 35, 65, 5d, 3a, 35, 30, 36, 37, 37, 24, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 31, 30, 38, 38, 3a, 36, 66, 66, 3a, 66, 65, 34, 65, 3a, 31, 61, 65, 66, 5d, 3a, 35, 30, 36, 37, 37, 24, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 31, 30, 38, 38, 3a, 36, 66, 66, 3a, 66, 65, 34, 65, 3a, 31, 61, 65, 66, 5d, 3a, 35, 30, 36, 37, 37, 24, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 33, 34, 35, 3a, 64, 31, 31, 31, 3a, 33, 30, 66, 38, 3a, 35, 39, 65, 33, 5d, 3a, 35, 30, 36, 37, 37, 25, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 65, 30, 36, 37, 3a, 66, 33, 38, 31, 3a, 31, 63, 35, 66, 3a, 38, 63, 64, 39, 5d, 3a, 35, 30, 36, 37, 37, 23, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 63, 65, 38, 31, 3a, 62, 31, 63, 3a, 62, 64, 32, 63, 3a, 36, 39, 65, 5d, 3a, 35, 30, 36, 37, 37, 17, 74, 63, 70, 2f, 31, 39, 32, 2e, 31, 36, 38, 2e, 31, 2e, 32, 31, 33, 3a, 35, 30, 36, 37, 37, 00, 03, 01, 00, 10, ea, 8c, c0, 98, f4, 3c, 20, fd, 7f, cf, 23, 7e, c3, 17, 90, c2, 02, 00]] }), ext_qos: QoS { priority: Data, congestion: Block, express: false }, ext_tstamp: None }) }

If you check the logs of the queryable, for instance if running:

RUST_LOG=trace ./z_queryable -l tcp/localhost:7447 --no-multicast-scouting

You'll see that we don't receive the QoS params as well:

2024-06-10T10:59:47.178370Z TRACE  rx-0 ThreadId(15) zenoh_transport::unicast::universal::rx: Received: TransportMessage { body: Frame(Frame { reliability: Reliable, sn: 131110397, ext_qos: QoSType { inner: 5 }, payload: [NetworkMessage { body: OAM(Oam { id: 1, body: ZBuf(ZBuf { slices: [[02, 07, 00, 02, 10, 98, ef, fa, a9, d4, fd, 7b, 1e, 2f, ec, d4, 9d, 86, a9, 0e, 95, 02, 0d, 32, 74, 63, 70, 2f, 5b, 32, 61, 30, 32, 3a, 38, 34, 32, 38, 3a, 36, 31, 38, 37, 3a, 63, 37, 30, 31, 3a, 63, 61, 34, 3a, 36, 30, 63, 65, 3a, 32, 36, 61, 36, 3a, 65, 30, 38, 39, 5d, 3a, 35, 30, 35, 35, 36, 33, 74, 63, 70, 2f, 5b, 32, 61, 30, 32, 3a, 38, 34, 32, 38, 3a, 36, 31, 38, 37, 3a, 63, 37, 30, 31, 3a, 61, 63, 37, 31, 3a, 62, 63, 31, 38, 3a, 32, 32, 37, 33, 3a, 61, 35, 61, 63, 5d, 3a, 35, 30, 35, 35, 36, 13, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 31, 5d, 3a, 35, 30, 35, 35, 36, 25, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 61, 34, 33, 37, 3a, 36, 31, 66, 66, 3a, 66, 65, 66, 30, 3a, 31, 32, 38, 62, 5d, 3a, 35, 30, 35, 35, 36, 25, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 61, 34, 33, 37, 3a, 36, 31, 66, 66, 3a, 66, 65, 66, 30, 3a, 31, 32, 38, 61, 5d, 3a, 35, 30, 35, 35, 36, 25, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 62, 63, 33, 65, 3a, 35, 33, 66, 66, 3a, 66, 65, 38, 63, 3a, 36, 33, 36, 37, 5d, 3a, 35, 30, 35, 35, 36, 25, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 31, 63, 63, 66, 3a, 37, 37, 61, 33, 3a, 37, 37, 61, 30, 3a, 62, 65, 35, 65, 5d, 3a, 35, 30, 35, 35, 36, 24, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 31, 30, 38, 38, 3a, 36, 66, 66, 3a, 66, 65, 34, 65, 3a, 31, 61, 65, 66, 5d, 3a, 35, 30, 35, 35, 36, 24, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 31, 30, 38, 38, 3a, 36, 66, 66, 3a, 66, 65, 34, 65, 3a, 31, 61, 65, 66, 5d, 3a, 35, 30, 35, 35, 36, 24, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 33, 34, 35, 3a, 64, 31, 31, 31, 3a, 33, 30, 66, 38, 3a, 35, 39, 65, 33, 5d, 3a, 35, 30, 35, 35, 36, 25, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 65, 30, 36, 37, 3a, 66, 33, 38, 31, 3a, 31, 63, 35, 66, 3a, 38, 63, 64, 39, 5d, 3a, 35, 30, 35, 35, 36, 23, 74, 63, 70, 2f, 5b, 66, 65, 38, 30, 3a, 3a, 63, 65, 38, 31, 3a, 62, 31, 63, 3a, 62, 64, 32, 63, 3a, 36, 39, 65, 5d, 3a, 35, 30, 35, 35, 36, 17, 74, 63, 70, 2f, 31, 39, 32, 2e, 31, 36, 38, 2e, 31, 2e, 32, 31, 33, 3a, 35, 30, 35, 35, 36, 00, 03, 01, 00, 10, c0, ca, 5d, ba, 81, 20, 02, 5e, bd, 07, 6c, 06, bf, 22, a0, c6, 02, 00]] }), ext_qos: QoS { priority: Data, congestion: Block, express: false }, ext_tstamp: None }) }, NetworkMessage { body: Declare(Declare { interest_id: Some(0), ext_qos: QoS { priority: Data, congestion: Drop, express: false }, ext_tstamp: None, ext_nodeid: NodeIdType { node_id: 0 }, body: DeclareFinal(DeclareFinal) }) }] }) }

So we observe:

Param Expected Received
Priority Background Data
Congestion control Drop Block
Express true false

Reply

Similarly, when specifying QoS parameters to a reply, they are not properly loaded.

We can modify the z_queryable example as follows, specifying some QoS parameters:

diff --git a/examples/examples/z_queryable.rs b/examples/examples/z_queryable.rs
index ede3eff63..6e3bceaf8 100644
--- a/examples/examples/z_queryable.rs
+++ b/examples/examples/z_queryable.rs
@@ -64,6 +64,9 @@ async fn main() {
         );
         query
             .reply(key_expr.clone(), value.clone())
+            .congestion_control(zenoh::publisher::CongestionControl::Drop)
+            .priority(zenoh::core::Priority::RealTime)
+            .express(true)
             .await
             .unwrap_or_else(|e| println!(">> [Queryable ] Error sending reply: {e}"));
     }

If we run it like this:

RUST_LOG=trace ./z_queryable -l tcp/localhost:7447 --no-multicast-scouting

and perform a get on it:

RUST_LOG=trace ./z_get -e tcp/localhost:7447 --no-multicast-scouting

When performing the reply, we see in the queryable logs:

2024-06-10T11:25:23.759062Z TRACE  main ThreadId(01) zenoh_transport::unicast::universal::tx: Scheduled: NetworkMessage { body: Response(Response { rid: 1, wire_expr: demo/example/zenoh-rs-queryable, payload: Reply(Reply { consolidation: Auto, ext_unknown: [], payload: Put(Put { timestamp: None, encoding: Encoding { id: 0, schema: None }, ext_sinfo: None, ext_attachment: None, ext_unknown: [], payload: ZBuf { slices: [[51, 75, 65, 72, 79, 61, 62, 6c, 65, 20, 66, 72, 6f, 6d, 20, 52, 75, 73, 74, 21]] } }) }), ext_qos: QoS { priority: Data, congestion: Block, express: false }, ext_tstamp: None, ext_respid: Some(EntityGlobalIdType { zid: b09ace6c9383169bd9aedd31f47ba43, eid: 2 }) }) }

which is received by the querier:

2024-06-10T11:25:23.761583Z TRACE  rx-2 ThreadId(17) zenoh_transport::unicast::universal::rx: Received: TransportMessage { body: Frame(Frame { reliability: Reliable, sn: 44219038, ext_qos: QoSType { inner: 5 }, payload: [NetworkMessage { body: Response(Response { rid: 1, wire_expr: demo/example/zenoh-rs-queryable, payload: Reply(Reply { consolidation: Auto, ext_unknown: [], payload: Put(Put { timestamp: None, encoding: Encoding { id: 0, schema: None }, ext_sinfo: None, ext_attachment: None, ext_unknown: [], payload: ZBuf { slices: [[51, 75, 65, 72, 79, 61, 62, 6c, 65, 20, 66, 72, 6f, 6d, 20, 52, 75, 73, 74, 21]] } }) }), ext_qos: QoS { priority: Data, congestion: Block, express: false }, ext_tstamp: None, ext_respid: Some(EntityGlobalIdType { zid: b09ace6c9383169bd9aedd31f47ba43, eid: 2 }) }) }, NetworkMessage { body: ResponseFinal(ResponseFinal { rid: 1, ext_qos: QoS { priority: Data, congestion: Block, express: false }, ext_tstamp: None }) }] }) }

So we observe:

Param Expected Received
Priority Realtime Data
Congestion control Drop Block
Express true false

System info

@DariusIMP DariusIMP added the bug Something isn't working label Jun 10, 2024
@yellowhatter
Copy link
Contributor

@DariusIMP checking this

@yellowhatter
Copy link
Contributor

@DariusIMP found the reason: there is no QoS ext handling in RequestBody::Query (probably forgotten). I will fix this

@yellowhatter
Copy link
Contributor

@Mallets @DariusIMP that's where the problem is:

fn send_request(&self, msg: Request) {

Mallets pushed a commit that referenced this issue Jun 10, 2024
* fix forgotten QoS and Timestamp ext processing for query/reply #1107

* fix priority bitfield managing
@DariusIMP
Copy link
Member Author

Fixed by PR #1108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants