-
Notifications
You must be signed in to change notification settings - Fork 103
Fix typesupport bug. #320
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 typesupport bug. #320
Conversation
|
@ivanpauno I find this an interesting bug. I know there are ways in which the addresses of the two strings being compared can end up being different (though I don't know exactly why it is happening with this bazel build) and I think the proposed solution is a sensible one. The only downside I can think of is that the check happens also when (de)serializing or freeing a message, but I doubt it would cause a noticeable slowdown. I think the information could be cached in the Another issue is that I scanned the sources and it looks like the dynamic versions of the fastrtps and connext RMW layers do the same thing, so those would presumably have to be changed as well. |
ivanpauno
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the information could be cached in the ddsi_sertype to avoid having to do the string compare often.
Yes, that sounds like a good idea.
Though I don't mind to introduce this fix first.
Another issue is that I scanned the sources and it looks like the dynamic versions of the fastrtps and connext RMW layers do the same thing, so those would presumably have to be changed as well.
@EvanLiUAV could you open a similar issue in rmw_fastrtps and rmw_connextdds?
| { | ||
| return typesupport_identifier == rosidl_typesupport_introspection_c__identifier; | ||
| static bool using_introspection_c_typesupport(const char* typesupport_identifier) { | ||
| return !std::string(typesupport_identifier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use std::strcmp()?
To avoid allocating a std::string unnecessarely.
In the case of I think the pointer should not change (at least in the case of |
The same happens here. IMO doing a pointer comparison is unnecessarily fragile, comparing the strings seem more reasonable and can be cached when the subscription is created if there's any performance concern. |
|
This one got stuck in review, but we now have #481 which does the same thing. So I'm going to close this one in favor of that. |
Currently when I was tried to use rules_ros2 in my bazel project. we found an issue as below No msg shown in listener logging.
The talker output:
the listener output:
I found that the typesupport problem is caused by the compare condition in this function.
so I check the using_introspection_cpp_typesupport function I found that the return condition is always false, the reason is using a pointer comparison rather than using std::string::compare.
The problem is solved when the conditions are correctly determined.
talker
listener
rqt
