-
Notifications
You must be signed in to change notification settings - Fork 34
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 support for user-specified content filters #68
Conversation
Signed-off-by: Andrea Sorbini <[email protected]>
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.
Thanks for creating this PR.
After confirming this PR with my cft_demo, I am ready to test it on the test cases of
such as, failed on ASSERT_EQ(RCL_RET_OK, rcl_context_fini(&context)); by the following test command
|
@iuhilnehc-ynos thank you for reviewing! I'll take a look at the failure and report back |
- Add missing package dependencies for rti_connext_dds_custom_sql_filter - Clean up all participants upon factory finalization - Reset context state upon finalization (rmw_connextddsmicro) Signed-off-by: Andrea Sorbini <[email protected]>
Memory leaks and unit-test failures fixed in d4788f9 |
Signed-off-by: Andrea Sorbini <[email protected]>
…t doesn't have one. - Rename internal functions related to content-filters Signed-off-by: Andrea Sorbini <[email protected]>
Signed-off-by: Andrea Sorbini <[email protected]>
- Make sure participant is enabled before deleting contained entities when using Connext debug libraries. Signed-off-by: Andrea Sorbini <[email protected]>
The failure of
Updated: Sorry, I cleaned my environment and rebuilt it, I think that there is no memory leak related to the current PR. |
Signed-off-by: Andrea Sorbini <[email protected]>
@iuhilnehc-ynos I did find some memory leaks (and they should be resolved now), but I wasn't able to reproduce the one you are seeing. I tried both Release and Debug, since I have introduced some guarded code for Debug-only to make sure that the participant is enabled before trying to delete a content-filtered topic (I added comments in the code about it). Please give a try to this latest version and let me know. |
Can I have a question not related to this PR? I don't know why RTIConnect needs to add
what do you think about the code snippet?
|
I agree that the single quotes are a bit quirky, but I'm not sure the spec needs clarification like that issue claims. From Annex B.2 ("SQL grammar in BNF"):
The one possible confusion might come from the fact that the spec does not explicitly say that values passed as parameters (a.k.a. token If I had to guess, the reason why string literals must be encapsulated in quotes could be that parameters are not typed and they are rather strings themselves. If strings didn't require explicit quotes for literal strings, there would be no way to determine if a string like, e.g., "2" should be interpreted as an integer parameter ( Nonetheless, the middleware could use type information about filtered samples to guess the type of a parameter, and I have checked internally, and this is in general a known interoperability issue. We plan to address it and resolve it in the next revision of the DDS spec (1.5), but unfortunately that will take a while to be approved and then implemented, and I don't have any other solutions to offer for now. Thankfully, it's not really a problem since Content-Filtered Topics are only supported by Connext :) |
I have updated the interface names on ros2/rmw#302. Besides that, I also updated some other name for the structure, mainly updating from rename_patch_based_on_13087f106acd106babf0719d1539a293233ab458.patch.txt Could you update this PR using the new interface names that you suggested? |
While that may be true now, my understanding is that both Cyclone DDS and Fast DDS are either working on support, or are very close to having support for this. So I'd be careful about making any decisions based on that. |
I'm glad to hear other implementations are also adding support. Hopefully they are doing so in a standard-compliant and interoperable way, making sure to test that their implementation works with other existing and compliant solutions. Unfortunately that hasn't always been the case so far, at least not for all vendors, so I won't hold my breath too long. |
Signed-off-by: Andrea Sorbini <[email protected]>
@iuhilnehc-ynos I applied the patch (thank you for providing it), pulled other repos and now doing a build to verify. I will push the changes as soon as that's finished. FYI I noticed that your |
Patch applied in 883e9cf |
Thank you. |
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 don't have bandwith to do a detailed review here, but once we polish the comments in ros2/rmw_fastrtps#513 and ros2/rmw#302 I think it's fine to go ahead with this one (with @iuhilnehc-ynos or @fujitatomoya approval).
@ivanpauno i will review tomorrow. @iuhilnehc-ynos can you also do final check the implementation just in case. CC: @asorbini |
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.
it looks good to me. but ros2/rmw#302 is under review, so we might need to do some adjustment.
@asorbini windows still unstable. |
@iuhilnehc-ynos if you have time, could you take a look at this? |
looking at https://ci.ros2.org/job/ci_windows/16746/, i think we just have cpplint minor error https://ci.ros2.org/job/ci_windows/16746/testReport/junit/rmw_connextdds_common/cpplint/build_header_guard__5___C__ci_ws_src_ros2_rmw_connextdds_rmw_connextdds_common_include_rmw_connextdds_custom_sql_filter_hpp_66_/. all the others are unrelated to this PR. |
Signed-off-by: Tomoya Fujita <[email protected]>
Signed-off-by: Tomoya Fujita <[email protected]>
@asorbini i rebased this branch on master with removing stub functions for CFT, and also addressed cpplint error. i will retry the whole CI for this branch. |
CI requires default rmw implementation, https://ci.ros2.org/job/ci_linux-aarch64/10995/console. retry with rmw_fastrtps and rmw_connextdds: |
@fujitatomoya thank you for addressing the linter errors! It looks like the arm64 build failed because no RMW was enabled |
We don't support Connext in aarch64, so no need to run that one. |
@asorbini there are still unstable errors, https://ci.ros2.org/job/ci_linux/16388/ sometimes I see the core crash with the following back trace. test_init__rmw_connextdds./build/rcl/test/test_init__rmw_connextdds
...
DDS_DomainParticipantFactory_get_participants:ERROR: Bad parameter: self
Segmentation fault (core dumped) root@tomoyafujita:~/ros2_ws/ros2-cft# gdb ./build/rcl/test/test_init__rmw_connextdds core
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./build/rcl/test/test_init__rmw_connextdds...
(No debugging symbols found in ./build/rcl/test/test_init__rmw_connextdds)
[New LWP 955990]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./build/rcl/test/test_init__rmw_connextdds'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007faabe68a224 in DDS_DomainParticipantFactory_unlockI ()
from /opt/rti.com/rti_connext_dds-5.3.1/lib/x64Linux3gcc5.4.0/libnddsc.so
(gdb) bt
#0 0x00007faabe68a224 in DDS_DomainParticipantFactory_unlockI ()
from /opt/rti.com/rti_connext_dds-5.3.1/lib/x64Linux3gcc5.4.0/libnddsc.so
#1 0x00007faabe68cdbe in DDS_DomainParticipantFactory_get_participants ()
from /opt/rti.com/rti_connext_dds-5.3.1/lib/x64Linux3gcc5.4.0/libnddsc.so
#2 0x00007faabef1e3e6 in rmw_connextdds_finalize_participant_factory_context(rmw_context_impl_s*) ()
from /root/ros2_ws/ros2-cft/install/rmw_connextdds_common/lib/librmw_connextdds_common_pro.so
#3 0x00007faabeebe606 in rmw_context_impl_s::finalize() [clone .part.0] ()
from /root/ros2_ws/ros2-cft/install/rmw_connextdds_common/lib/librmw_connextdds_common_pro.so
#4 0x00007faabeebfc85 in rmw_api_connextdds_init(rmw_init_options_s const*, rmw_context_s*)::{lambda()#3}::operator()() const [clone .isra.0] () from /root/ros2_ws/ros2-cft/install/rmw_connextdds_common/lib/librmw_connextdds_common_pro.so
#5 0x00007faabeec4c7e in rmw_api_connextdds_init(rmw_init_options_s const*, rmw_context_s*) ()
from /root/ros2_ws/ros2-cft/install/rmw_connextdds_common/lib/librmw_connextdds_common_pro.so
#6 0x00007faabf4fd63f in rcl_init () from /root/ros2_ws/ros2-cft/install/rcl/lib/librcl.so
#7 0x0000565109771f17 in TestRCLFixture__rmw_connextdds_test_rcl_init_internal_error_Test::TestBody() ()
#8 0x00005651097bb2a1 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#9 0x00005651097af546 in testing::Test::Run() ()
#10 0x00005651097af6a5 in testing::TestInfo::Run() ()
#11 0x00005651097af7cd in testing::TestSuite::Run() ()
#12 0x00005651097afd73 in testing::internal::UnitTestImpl::RunAllTests() ()
#13 0x00005651097affd8 in testing::UnitTest::Run() ()
#14 0x000056510976bb34 in main () and if i do not see the coredump, i meet the bunch of following errors in console.
i think this is really hard to debug on our side since it seems related to DDS implementation. |
windows also unstable,
|
Signed-off-by: Andrea Sorbini <[email protected]>
Signed-off-by: Andrea Sorbini <[email protected]>
Thank you for pointing this out, I will investigate and try to fix it. I believe it has to do with error handling code in the RMW more than internal Connext code. It seems like the RMW is trying to list the local participants, but the DDS factory has not been initialized yet. It might be as easy as adding a check for |
Signed-off-by: Andrea Sorbini <[email protected]>
I'm getting to this quite late, and so the code freeze deadline is something you'll want to take up with @clalancette but in terms of general feasibility the logic in https://github.com/ros2/ci/blob/9815af79f8edca8a89e3ad913bb6bc5b7a5fb906/ros2_batch_job/__main__.py#L699-L721 just needs to be updated to include additional packages around rmw_connextdds and that does not require a re-deploy as long as the new package does not add any additional dependencies at the system level. If it does add new dependencies, then that is definitely an rmw freeze problem and at this stage I would say it would be best not to do that for Humble.
There are several steps to making this happen and I'd love to complete our RHEL support for Connext as well. When you've got cycles for this @asorbini I'd suggest opening an "extending platform support" or similarly phrased issue on rmw_connextdds. The current way we're distributing Pro artifacts is pretty much at its breaking point so I'd like not to add more (such as for arm64) to it without refactoring it. |
@asorbini confirmed that #68 (comment) is also solved with my local environment. thanks! |
@fujitatomoya that's great to hear. I think the PR should be ready for being merged 🚀 @nuclearsandwich Thank you for replying and confirming the changes. I ended up getting rid of that additional module since it didn't add much other than several (albeit minor) headaches. Probably not right away, but I'll follow up on your suggestion to track changes to platform support in an issue, and I'm happy to discuss existing issues and possible solutions either there on in a separate email thread whenever you want. |
@asorbini thanks for the fix, this has been merged! |
* Add support for user-specified content filters. Signed-off-by: Andrea Sorbini <[email protected]> * - Resolve memory leak of custom content-filter resources - Add missing package dependencies for rti_connext_dds_custom_sql_filter - Clean up all participants upon factory finalization - Reset context state upon finalization (rmw_connextddsmicro) Signed-off-by: Andrea Sorbini <[email protected]> * Assume non-null options argument Signed-off-by: Andrea Sorbini <[email protected]> * - Return error when retrieving content-filter from a subscription that doesn't have one. - Rename internal functions related to content-filters Signed-off-by: Andrea Sorbini <[email protected]> * Fix compilation error, oops. Signed-off-by: Andrea Sorbini <[email protected]> * - Define RMW_CONNEXT_DEBUG when building Debug libraries. - Make sure participant is enabled before deleting contained entities when using Connext debug libraries. Signed-off-by: Andrea Sorbini <[email protected]> * Resolve memory leak for finalization on error. Signed-off-by: Andrea Sorbini <[email protected]> * Rename content filter public API. Signed-off-by: Andrea Sorbini <[email protected]> * Add client/service QoS getters (ros2#67) Signed-off-by: Mauro Passerino <[email protected]> * Changelogs Signed-off-by: Ivan Santiago Paunovic <[email protected]> * 0.8.1 * Fix cpplint errors (ros2#69) * Use static_cast instead of C-style cast Fixes cpplint error. Signed-off-by: Jacob Perron <[email protected]> * Update NOLINT category Relates to ament/ament_lint#324 Signed-off-by: Jacob Perron <[email protected]> * 0.8.2 Signed-off-by: Audrow Nash <[email protected]> * Update rti-connext-dds dependency to 6.0.1. (ros2#71) Now that this package is available in the ROS bootstrap repository for Ubuntu Focal and Jammy we can bump the expected dependency version. * 0.8.3 * Add rmw listener apis (ros2#44) * Add stubs for setting listener callbacks Signed-off-by: Mauro Passerino <[email protected]> * Address PR suggestions Signed-off-by: Mauro Passerino <[email protected]> * Fix linter issues Signed-off-by: Mauro Passerino <[email protected]> Co-authored-by: Mauro Passerino <[email protected]> Co-authored-by: Alberto Soragna <[email protected]> * Changelog. (ros2#73) Signed-off-by: Chris Lalancette <[email protected]> * 0.9.0 * add stub for content filtered topic Signed-off-by: Chen Lihui <[email protected]> * * Rebased branch asorbini/cft on top of 0.9.0. * Resolved CFT finalization issues on error. * Verified and cleaned up build for rmw_connextddsmicro. Signed-off-by: Andrea Sorbini <[email protected]> * Move custom SQL filter to rmw_connextdds_common Signed-off-by: Andrea Sorbini <[email protected]> * Try to resolve linking error on Windows. Signed-off-by: Andrea Sorbini <[email protected]> * Optionally disable writer-side CFT optimizations to support Windows. Signed-off-by: Andrea Sorbini <[email protected]> * No need to declare private CFT function on Windows. Signed-off-by: Andrea Sorbini <[email protected]> * remove stub implementation for ContentFilteredTopic. Signed-off-by: Tomoya Fujita <[email protected]> * address cpplint error. Signed-off-by: Tomoya Fujita <[email protected]> * Avoid conversion warnings on Windows. Signed-off-by: Andrea Sorbini <[email protected]> * Use strtol instead of sscanf to avoid warnings on Windows. Signed-off-by: Andrea Sorbini <[email protected]> * Avoid finalizing participants if factory is not available. Signed-off-by: Andrea Sorbini <[email protected]> Co-authored-by: mauropasse <[email protected]> Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Jacob Perron <[email protected]> Co-authored-by: Audrow Nash <[email protected]> Co-authored-by: Steven! Ragnarök <[email protected]> Co-authored-by: Steven! Ragnarök <[email protected]> Co-authored-by: iRobot ROS <[email protected]> Co-authored-by: Mauro Passerino <[email protected]> Co-authored-by: Alberto Soragna <[email protected]> Co-authored-by: Chris Lalancette <[email protected]> Co-authored-by: Chen Lihui <[email protected]> Co-authored-by: Tomoya Fujita <[email protected]>
* Add sequence numbers to message info structure (#74) * Fill reception_sequence_number/publication_sequence_number in all rmw_take_*_with_info() functions Signed-off-by: Ivan Santiago Paunovic <[email protected]> * Add rmw_feature_supported() Signed-off-by: Ivan Santiago Paunovic <[email protected]> * add stub for content filtered topic (#77) * add stub for content filtered topic Signed-off-by: Chen Lihui <[email protected]> * Add support for user-specified content filters (#68) * Add support for user-specified content filters. Signed-off-by: Andrea Sorbini <[email protected]> * - Resolve memory leak of custom content-filter resources - Add missing package dependencies for rti_connext_dds_custom_sql_filter - Clean up all participants upon factory finalization - Reset context state upon finalization (rmw_connextddsmicro) Signed-off-by: Andrea Sorbini <[email protected]> * Assume non-null options argument Signed-off-by: Andrea Sorbini <[email protected]> * - Return error when retrieving content-filter from a subscription that doesn't have one. - Rename internal functions related to content-filters Signed-off-by: Andrea Sorbini <[email protected]> * Fix compilation error, oops. Signed-off-by: Andrea Sorbini <[email protected]> * - Define RMW_CONNEXT_DEBUG when building Debug libraries. - Make sure participant is enabled before deleting contained entities when using Connext debug libraries. Signed-off-by: Andrea Sorbini <[email protected]> * Resolve memory leak for finalization on error. Signed-off-by: Andrea Sorbini <[email protected]> * Rename content filter public API. Signed-off-by: Andrea Sorbini <[email protected]> * Add client/service QoS getters (#67) Signed-off-by: Mauro Passerino <[email protected]> * Changelogs Signed-off-by: Ivan Santiago Paunovic <[email protected]> * 0.8.1 * Fix cpplint errors (#69) * Use static_cast instead of C-style cast Fixes cpplint error. Signed-off-by: Jacob Perron <[email protected]> * Update NOLINT category Relates to ament/ament_lint#324 Signed-off-by: Jacob Perron <[email protected]> * 0.8.2 Signed-off-by: Audrow Nash <[email protected]> * Update rti-connext-dds dependency to 6.0.1. (#71) Now that this package is available in the ROS bootstrap repository for Ubuntu Focal and Jammy we can bump the expected dependency version. * 0.8.3 * Add rmw listener apis (#44) * Add stubs for setting listener callbacks Signed-off-by: Mauro Passerino <[email protected]> * Address PR suggestions Signed-off-by: Mauro Passerino <[email protected]> * Fix linter issues Signed-off-by: Mauro Passerino <[email protected]> Co-authored-by: Mauro Passerino <[email protected]> Co-authored-by: Alberto Soragna <[email protected]> * Changelog. (#73) Signed-off-by: Chris Lalancette <[email protected]> * 0.9.0 * add stub for content filtered topic Signed-off-by: Chen Lihui <[email protected]> * * Rebased branch asorbini/cft on top of 0.9.0. * Resolved CFT finalization issues on error. * Verified and cleaned up build for rmw_connextddsmicro. Signed-off-by: Andrea Sorbini <[email protected]> * Move custom SQL filter to rmw_connextdds_common Signed-off-by: Andrea Sorbini <[email protected]> * Try to resolve linking error on Windows. Signed-off-by: Andrea Sorbini <[email protected]> * Optionally disable writer-side CFT optimizations to support Windows. Signed-off-by: Andrea Sorbini <[email protected]> * No need to declare private CFT function on Windows. Signed-off-by: Andrea Sorbini <[email protected]> * remove stub implementation for ContentFilteredTopic. Signed-off-by: Tomoya Fujita <[email protected]> * address cpplint error. Signed-off-by: Tomoya Fujita <[email protected]> * Avoid conversion warnings on Windows. Signed-off-by: Andrea Sorbini <[email protected]> * Use strtol instead of sscanf to avoid warnings on Windows. Signed-off-by: Andrea Sorbini <[email protected]> * Avoid finalizing participants if factory is not available. Signed-off-by: Andrea Sorbini <[email protected]> Co-authored-by: mauropasse <[email protected]> Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Jacob Perron <[email protected]> Co-authored-by: Audrow Nash <[email protected]> Co-authored-by: Steven! Ragnarök <[email protected]> Co-authored-by: Steven! Ragnarök <[email protected]> Co-authored-by: iRobot ROS <[email protected]> Co-authored-by: Mauro Passerino <[email protected]> Co-authored-by: Alberto Soragna <[email protected]> Co-authored-by: Chris Lalancette <[email protected]> Co-authored-by: Chen Lihui <[email protected]> Co-authored-by: Tomoya Fujita <[email protected]> * 0.10.0 Signed-off-by: Audrow Nash <[email protected]> * Update launch_testing_ros output filter prefixes for Connext6 (#80) Signed-off-by: Ivan Santiago Paunovic <[email protected]> * Properly initialize CDR stream before using it for filtering (#81) Signed-off-by: Andrea Sorbini <[email protected]> * Exclude missing sample info fields when building rmw_connextddsmicro (#79) * Exclude missing sample info fields when building micro. * Report features individually for each RMW implementation. * Return special value for unsupported sequence numbers. Signed-off-by: Andrea Sorbini <[email protected]> Co-authored-by: Chris Lalancette <[email protected]> * 0.11.0 Signed-off-by: Audrow Nash <[email protected]> * Resolve build error with RTI Connext DDS 5.3.1 (#82) Signed-off-by: Andrea Sorbini <[email protected]> * Changelog. Signed-off-by: Chris Lalancette <[email protected]> * 0.11.1 * Use destinct callbacks for each event type --------- Signed-off-by: Ivan Santiago Paunovic <[email protected]> Signed-off-by: Chen Lihui <[email protected]> Signed-off-by: Audrow Nash <[email protected]> Signed-off-by: Andrea Sorbini <[email protected]> Signed-off-by: Chris Lalancette <[email protected]> Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Chen Lihui <[email protected]> Co-authored-by: Andrea Sorbini <[email protected]> Co-authored-by: mauropasse <[email protected]> Co-authored-by: Jacob Perron <[email protected]> Co-authored-by: Audrow Nash <[email protected]> Co-authored-by: Steven! Ragnarök <[email protected]> Co-authored-by: Steven! Ragnarök <[email protected]> Co-authored-by: iRobot ROS <[email protected]> Co-authored-by: Mauro Passerino <[email protected]> Co-authored-by: Alberto Soragna <[email protected]> Co-authored-by: Chris Lalancette <[email protected]> Co-authored-by: Tomoya Fujita <[email protected]>
This PR is a follow up to #12 which takes a different approach in introducing support for content-filtered topics by trying to simplify the implementation and overcome some issues that arose during development of that PR, particularly with respect to concurrency.
The main problem introduced by #12 is the need to delete and re-create the DDS DataReader if the content-filter expression of the associated ROS2 Subscription is modified. Specifically, if the reader was associated with a content-filtered topic and the expression is empty, the reader must be recreated on the base, unfiltered, topic, and viceversa (if the reader didn't have a filter and must now use one, it will be deleted and recreated on a new content-filtered topic).
Beside introducing a whole lot of concurrency problems, a big issue with this strategy is that it makes "enabling/disabling filtering" a very expensive operation both locally (because the existing reader must be finalized and a new one created, causing potentially a whole lot of memory deallocation/allocation), and remotely/on the network (since the deletion of reader will be announced to other participants in order to unmatch it from any remote writer that was communicating with it, and then the new reader will need to be announced and re-matched again).
This is an unfortunate byproduct of the existing DDS API which differentiates between "regular topics" and "content-fitlered topics" instead of making the "filter" a property of the DataReader: if it were possible to create a content-filtered topic with an empty expression (which would cause it to behave like the base unfiltered topic), it would be possible for
rmw_connextdds
to always create a content-filtered topic for every new subscription, even when no filter expression is specified by the user.In order to enable this use case, we take advantage of RTI Connext DDS' ability to register custom content-filter implementations and create a new custom content-filter which extends the built-in SQL-like filter included in Connext by adding the ability to handle empty filter expressions.
All DataReaders created by
rmw_connextdds
now use a content-filtered topic, and the ROS2 layer can easily manipulate the filtering expression.The custom content filter is encapsulated in a new package,
rti_connext_dds_custom_sql_filter
.The filter supports writer-side filtering but it might introduce some minor overhead in the case of an empty expression. This overhead should be characterized through performance testing to make sure any degradation is within an acceptable range.
The branch for this PR was created off of the current
master
(944da9d) with the addition of the implementation for new RMW APIs and some changes to existing internal functions to create content-filtered topics that were introduced by @iuhilnehc-ynos in #12.