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

Add trace log while dropping the messages. #1607

Merged
merged 2 commits into from
Nov 22, 2024
Merged
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
4 changes: 4 additions & 0 deletions io/zenoh-transport/src/common/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ impl StageIn {
// Still no available batch.
// Restore the sequence number and drop the message
$($restore_sn)?
tracing::trace!(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for catching it only now, but in case $restore_sn returns early, the log will not be printed but the message will still be dropped. What about moving the log before $restore_sn? Please double check what is actually executed in the $restore_sn.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I will double check that, although the return value is bool and I don't think it can be returned earlier

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, then I'm a bit confused about the $($restore_sn)? syntax. What is ?? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means the code is optional. It will be added if the macro has the argument $restore_sn
For example, https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=07557c8c874e8944528c3f030c7f96dc

In our case, $($restore_sn)? will become tch.sn.set(sn).unwrap() according to

batch = zgetbatch_rets!(tch.sn.set(sn).unwrap());

And will become empty when it comes to

let mut batch = zgetbatch_rets!();

BTW, I just learned that we can easily get expanded macro with rust-analyzer in vscode
https://stackoverflow.com/a/71454821/22130710
Learn something new each day 😆

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

"Zenoh message dropped because it's over the deadline {:?}: {:?}",
deadline.lazy_deadline.wait_time, msg
);
return false;
}
c_guard = self.mutex.current();
Expand Down