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

Fix discovery silently stops after unknown msg type is found. #848

Merged
merged 2 commits into from
Aug 26, 2021

Conversation

llapx
Copy link
Contributor

@llapx llapx commented Aug 16, 2021

Signed-off-by: Lei Liu Lei.Liu.AP@sony.com

This PR fixed (#829)

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
@llapx llapx requested a review from a team as a code owner August 16, 2021 05:00
@llapx llapx requested review from emersonknapp and jhdcs and removed request for a team August 16, 2021 05:00
@fujitatomoya
Copy link
Contributor

@Barry-Xu-2018 would you mind taking time for review since this comes from us. I'll do the same.

@Barry-Xu-2018
Copy link
Contributor

@fujitatomoya

would you mind taking time for review since this comes from us. I'll do the same.

Yeah. I will check this PR.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
@Barry-Xu-2018
Copy link
Contributor

I have no comments on the latest updating.

Copy link
Contributor

@jhdcs jhdcs left a comment

Choose a reason for hiding this comment

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

Looks good to me, as long as it passes CI

@emersonknapp
Copy link
Collaborator

Before I approve this PR - I am wondering if there is a simpler way to implement this. Does the existing behavior throw an exception when it tries to create a subscription to an unknown type, thus cancelling the discovery behavior? Can we simply catch this exception and print a warning message - instead of implementing complex filtering logic?

@llapx
Copy link
Contributor Author

llapx commented Aug 25, 2021

Does the existing behavior throw an exception when it tries to create a subscription to an unknown type, thus cancelling the discovery behavior?

Yes, when create a subscription with an unknown type, will throw a exception and lead to the discovery process stuck.

Can we simply catch this exception and print a warning message

The simple way is try to skip create_subscription with unknown type and print warning like this:

...
std::shared_ptr<rclcpp::GenericSubscription>
Recorder::create_subscription(
  const std::string & topic_name, const std::string & topic_type, const rclcpp::QoS & qos)
{
  // << catch the exception below >>
  auto subscription = this->create_generic_subscription(
    topic_name,
    topic_type,
    qos,
    [this, topic_name](std::shared_ptr<rclcpp::SerializedMessage> message) {
      auto bag_message = std::make_shared<rosbag2_storage::SerializedBagMessage>();
...

but this will print warning in a loop if someone continue sending the unknown type messages, this may flush the log.

instead of implementing complex filtering logic?

so I tried to filter out the unknown type messages, and keep the unknown types to make it only print warning once, I think this may good for performance.

Copy link
Contributor

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

looks good to me

@emersonknapp
Copy link
Collaborator

emersonknapp commented Aug 26, 2021

but this will print warning in a loop

Oh - good call. I didn't realize that because of get_missing_topics, it would keep trying to create the subscription repeatedly. OK, this sounds good to me

@emersonknapp
Copy link
Collaborator

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@emersonknapp emersonknapp merged commit 891e081 into ros2:master Aug 26, 2021
emersonknapp pushed a commit that referenced this pull request Aug 30, 2021
* Discovery silently stops after unknown msg type is found.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
emersonknapp pushed a commit that referenced this pull request Aug 30, 2021
* Discovery silently stops after unknown msg type is found.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
emersonknapp added a commit that referenced this pull request Sep 2, 2021
…858)

* Discovery silently stops after unknown msg type is found.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
WJaworskiRobotec pushed a commit to RobotecAI/rosbag2 that referenced this pull request Sep 12, 2021
* Discovery silently stops after unknown msg type is found.

Signed-off-by: Lei Liu <Lei.Liu.AP@sony.com>
Signed-off-by: Wojciech Jaworski <wojciech.jaworski@robotec.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants