You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement subscription side filtering when intra process is being used #91
Currently, there is nothing stopping a subscriber from receiving messages from both the intra process mechanism and the inter-process mechanism. Therefore publishers and subscriptions connected by intra process should avoid (through filtering or some other mechanism) exchanging messages using the inter process communications.
So far I have looked into:
Publisher side filtering: before calling rmw_publish, make sure someone is going to get it, i.e. len(connected_subscritpions - intra_process_subscriptions) > 0.
The problem with this is latching. If we never call rmw_publish then when a new subscription comes up the message will not be delivered via the latched mechanism.
I haven't gotten this to work as expected, I think because of when the function must be called (cannot be called after creating the publisher), but it needs more investigation.
It is not implemented by some vendors like OpenSplice.
Subscription side filtering: simply not delivering messages received from inter process from publishers which are connected via intra process.
This is inefficient since the publisher has to serialize and send and the subscription must then receive and deserialize the message before dropping it.
Without help from the middleware this may have to happen anyways (like if multicast is being used).
As a stop gap measure we should implement the subscription side filtering so that users don't get duplicate callbacks when intra process is being used.
If other methods become available then we can change how we do it then.
I like the idea behind the first approach best, but it may mean creating a hack-y code path for latched messages (if publishing a latched topic, store an "in flight" message in the intra-process manager, and short-circuit take_intra_process_message for the subscriber to the latched topic when it instantiated).
I like the idea behind the first approach best, but it may mean creating a hack-y code path for latched messages (if publishing a latched topic, store an "in flight" message in the intra-process manager, and short-circuit take_intra_process_message for the subscriber to the latched topic when it instantiated).
Yeah, the issue is with inter process subscriptions. If we never call rmw_publish (in order to avoid duplicate delivery to the intra process subscription) then we cannot rely on DDS's persistence QoS to handle latching for us (because we never gave it the message to persist). It's likely that the first solution would also need the subscription filtering in order to be used with latching.
Ok, I've now tested it against opensplice and it works. I still don't have a good way to prove it in a test. I tested it by printing messages when entering each handle function (handle intra and handle inter processing messages) as well as printing something when a inter process message is explicitly dropped.
I need to make some changes to the rclcpp API to really test end to end pointer preservation. That will probably be the most convincing proof that intra process is working. That coupled with asserting that no duplicate messages get through should be a good test.
Also based on @dirk-thomas's suggestion take now optionally returns a rmw_message_info_t struct which currently only contains a rmw_gid_t for the publisher, but could later include things like the received timestamp and maybe other stuff.
I still haven't gotten to the tests that @jacquelinekay suggested (I mention them higher in this thread).
I think we should get the outstanding pull requests merged and then I can open more pull requests to adjust the rclcpp API to include more callback signatures for testing and to add the missing tests.
This is ready for review. I'll squash after review.
Now I'm working on the ability to receive the message info object in the rclcpp callback so that we can write tests which assert that intra process is being used. That PR will depend on this set. Once I have that I can write the tests described above.
The warnings have been fixed on Windows and the other two jobs are still good.
There is a new failing test on OS X, but I don't think it is related, and instead might be flaky. I don't want to take the time to debug that right now, so I opened an issue about it: ros2/system_tests#36
There is also a new failing test on Linux (different from the one on OS X) which I saw while writing this. I'll open an issue for that too. It also seems unrelated to these changes and it passed on the previous build.
Activity
jackieokay commentedon Aug 19, 2015
I like the idea behind the first approach best, but it may mean creating a hack-y code path for latched messages (if publishing a latched topic, store an "in flight" message in the intra-process manager, and short-circuit
take_intra_process_messagefor the subscriber to the latched topic when it instantiated).wjwwood commentedon Aug 19, 2015
@jacquelinekay suggested we test:
wjwwood commentedon Aug 19, 2015
Yeah, the issue is with inter process subscriptions. If we never call rmw_publish (in order to avoid duplicate delivery to the intra process subscription) then we cannot rely on DDS's persistence QoS to handle latching for us (because we never gave it the message to persist). It's likely that the first solution would also need the subscription filtering in order to be used with latching.
wjwwood commentedon Aug 25, 2015
Ok, I've now tested it against opensplice and it works. I still don't have a good way to prove it in a test. I tested it by printing messages when entering each handle function (handle intra and handle inter processing messages) as well as printing something when a inter process message is explicitly dropped.
I need to make some changes to the rclcpp API to really test end to end pointer preservation. That will probably be the most convincing proof that intra process is working. That coupled with asserting that no duplicate messages get through should be a good test.
Also based on @dirk-thomas's suggestion take now optionally returns a
rmw_message_info_tstruct which currently only contains armw_gid_tfor the publisher, but could later include things like the received timestamp and maybe other stuff.wjwwood commentedon Aug 25, 2015
I still haven't gotten to the tests that @jacquelinekay suggested (I mention them higher in this thread).
I think we should get the outstanding pull requests merged and then I can open more pull requests to adjust the rclcpp API to include more callback signatures for testing and to add the missing tests.
wjwwood commentedon Aug 25, 2015
Before merge I have to implement for Connext and Connext Dynamic. I'll do that now and report back when it's ready for final review.
wjwwood commentedon Aug 25, 2015
Ok, Connext and Connext Dyanmic are implemented. I'm going to write another system test or two and then this will be ready for final review.
wjwwood commentedon Aug 25, 2015
I'm still working on a system test, but here are some preliminary CI jobs:
wjwwood commentedon Aug 26, 2015
I fixed some tests and addressed outstanding uncrustify style stuff, here are new CI:
This is ready for review. I'll squash after review.
Now I'm working on the ability to receive the message info object in the rclcpp callback so that we can write tests which assert that intra process is being used. That PR will depend on this set. Once I have that I can write the tests described above.
jackieokay commentedon Aug 26, 2015
Everything looks good except for the Windows build. What's going on there?
wjwwood commentedon Aug 26, 2015
@jacquelinekay I have no idea, I was hoping it would just go away. I'm looking into it now...
wjwwood commentedon Aug 26, 2015
I guess I need to turn on
/bigobj: https://msdn.microsoft.com/en-us/library/8578y171.aspxEither that or start refactoring our code base...
wjwwood commentedon Aug 26, 2015
Ok, I added that flag, we'll see if it fixes the problem for now, new CI:
wjwwood commentedon Aug 26, 2015
Try, try again: http://ci.ros2.org/job/ros2_batch_ci_windows/274/
wjwwood commentedon Aug 26, 2015
This one should fix the warnings:
I'll also run the other CI again to ensure it didn't break them:
wjwwood commentedon Aug 26, 2015
The warnings have been fixed on Windows and the other two jobs are still good.
There is a new failing test on OS X, but I don't think it is related, and instead might be flaky. I don't want to take the time to debug that right now, so I opened an issue about it: ros2/system_tests#36
There is also a new failing test on Linux (different from the one on OS X) which I saw while writing this. I'll open an issue for that too. It also seems unrelated to these changes and it passed on the previous build.
wjwwood commentedon Aug 26, 2015
Follow up issue: ros2/system_tests#37
wjwwood commentedon Aug 26, 2015
I think the outstanding pr's are ready to merge.