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

LivelinessTokens/Queryables declaration order #588

Closed
OlivierHecart opened this issue Nov 14, 2023 · 0 comments · Fixed by #589
Closed

LivelinessTokens/Queryables declaration order #588

OlivierHecart opened this issue Nov 14, 2023 · 0 comments · Fixed by #589
Labels
bug Something isn't working

Comments

@OlivierHecart
Copy link
Contributor

Describe the bug

In case of reconnection, Liveliness tokens are propagated prior to Queryable declarations. So when reacting to a Liveliness token to issue a get, the Queryable declaration might have not yet been propagated and the get might fail.

To reproduce

Using the following examples:
queryable:

let session = zenoh::open(config).res().await.unwrap();

println!("Declaring Queryable on 'key/expression'...");
let queryable = session
    .declare_queryable("key/expression")
    .res()
    .await
    .unwrap();

let _token = session
    .liveliness()
    .declare_token("key/expression")
    .res()
    .await
    .unwrap();

while let Ok(query) = queryable.recv_async().await {
    query
        .reply(Ok(Sample::new(
            KeyExpr::try_from("key/expression").unwrap(),
            "value",
        )))
        .res()
        .await
        .unwrap();
}

get:

let session = zenoh::open(config).res().await.unwrap();

let listener = session
    .liveliness()
    .declare_subscriber("key/expression")
    .res()
    .await
    .unwrap();

while let Ok(token) = listener.recv_async().await {
    if token.kind == SampleKind::Put {
        println!("Sending Query 'key/expression'...");
        let replies = session.get("key/expression").res().await.unwrap();
        while let Ok(reply) = replies.recv_async().await {
            println!(">> Received {:?}", reply);
        }
    }
}
  1. Run Zenoh router
  2. Run the examples as clients
  3. Kill Zenoh Router
  4. Restart Zenoh Router
  5. The get might randomly get no results.

System info

zenoh v0.11.0-dev-20-gd2399cad

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

Successfully merging a pull request may close this issue.

1 participant