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 transient local IPC publish #2708

Merged
merged 6 commits into from
Dec 20, 2024

Conversation

jefferyyjhsu
Copy link
Contributor

@jefferyyjhsu jefferyyjhsu commented Dec 13, 2024

Signed-off-by: Jeffery Hsu jefferyyjhsu@gmail.com

Fix transient local publish when inter and intra process communications are both present described in #2704.
Add a new test case for transient local publish mixing communication types.

@jefferyyjhsu jefferyyjhsu force-pushed the Transient-Local_ipc_rmw_fix branch from 17b043d to d7578fc Compare December 14, 2024 02:52
@alsora
Copy link
Collaborator

alsora commented Dec 14, 2024

Thank you @jefferyyjhsu !
The PR looks good to me

CI

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

rclcpp/test/rclcpp/test_publisher.cpp Outdated Show resolved Hide resolved
rclcpp/test/rclcpp/test_publisher.cpp Outdated Show resolved Hide resolved
@alsora
Copy link
Collaborator

alsora commented Dec 15, 2024

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@fujitatomoya
Copy link
Collaborator

@jefferyyjhsu thanks for fixing. it looks some errors came up with CI, could you also check those?

@jefferyyjhsu
Copy link
Contributor Author

jefferyyjhsu commented Dec 16, 2024

@fujitatomoya and @alsora
I need some input from you guys.

  1. The new unit test case I added is unstable, I am wondering if it's because I need to call rclcpp::spin_some() in the test case, so inter_process new_message_callback will be executed. However, I don't quite understand why the test case don't fail constantly locally for me.
  2. TestServiceIntrospection.service_introspection_nominal is failing for me constantly on my local machine. I am working in a ros:rolling docker container. I am not sure if I should worry about it as it seems unrelated to my change here.
/ros2_ws/src/rclcpp/test/rclcpp/test_service_introspection.cpp:138: Failure
Value of: client_gid_arr
Expected: is equal to { '\x1' (1), '\xF' (15), '\xEB' (235), '}' (125, 0x7D), 'S' (83, 0x53), '{' (123, 0x7B), 'O' (79, 0x4F), '\x8C' (140), '\0', '\0', '\0', '\0', '\0', '\0', '\x14' (20), '\x4' (4) }
  Actual: { '\x1' (1), '\xF' (15), '\xEB' (235), '}' (125, 0x7D), 'S' (83, 0x53), '{' (123, 0x7B), 'O' (79, 0x4F), '\x8C' (140), '\0', '\0', '\0', '\0', '\0', '\0', '\x15' (21), '\x3' (3) }

@fujitatomoya
Copy link
Collaborator

The new unit test case I added is unstable, I am wondering if it's because I need to call rclcpp::spin_some() in the test case, so inter_process new_message_callback will be executed. However, I don't quite understand why the test case don't fail constantly locally for me.

hm... it does not ring a bell for me. @alsora any thoughts?

TestServiceIntrospection.service_introspection_nominal is failing for me constantly on my local machine. I am working in a ros:rolling docker container. I am not sure if I should worry about it as it seems unrelated to my change here.

this should be unrelated.

because you are using ros:rolling container to test your PR, the following fix is not included in rmw_fastrtps package.

ros2/rmw_fastrtps@8fd6f3c, without it, the test should fail.

after all, to avoid this package dependencies, i suggest that full source build with your rclcpp package branch, https://docs.ros.org/en/rolling/Installation/Alternatives/Ubuntu-Development-Setup.html

@clalancette
Copy link
Contributor

  1. The new unit test case I added is unstable, I am wondering if it's because I need to call rclcpp::spin_some() in the test case, so inter_process new_message_callback will be executed. However, I don't quite understand why the test case don't fail constantly locally for me.

Yes, you definitely need to spin for things to work. My suggestion is that you create an executor and spin right after setting up the subscription callbacks (and make sure to use spin, not spin_some, as that has some other drawbacks).

@alsora
Copy link
Collaborator

alsora commented Dec 18, 2024

Yes, as others have said, you will need to create an executor and spin.
The node that you are using is not automatically added to any executor.

To expand on what others have said, you can:

  • create an executor and add the node to it
  • create a thread and let the executor spin in this thread
  • do a "busy loop" until called becomes true or a timeout occurs
  • stop the executor and join the thread

The new unit test case I added is unstable,

I would expect this test to fail 100% of the times with the current code.

…ns are both present.

Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
@jefferyyjhsu jefferyyjhsu force-pushed the Transient-Local_ipc_rmw_fix branch from d58c575 to 8a49985 Compare December 19, 2024 23:53
…st case to enable inter process publishing test

Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
@jefferyyjhsu jefferyyjhsu force-pushed the Transient-Local_ipc_rmw_fix branch from 8a49985 to 3fd1ea4 Compare December 20, 2024 00:32
Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
Copy link
Collaborator

@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.

lgtm with green CI

@fujitatomoya
Copy link
Collaborator

Pulls: #2708
Gist: https://gist.githubusercontent.com/fujitatomoya/b3ddef54881873cfc618f5cbfa81ae61/raw/1cfaa305cde6a30dfa3013ae440a9b914f5b0942/ros2.repos
BUILD args: --packages-above-and-dependencies rclcpp
TEST args: --packages-above rclcpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/14986

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@clalancette clalancette merged commit f5e08c2 into ros2:rolling Dec 20, 2024
3 checks passed
@SteveMacenski
Copy link
Collaborator

SteveMacenski commented Jan 6, 2025

@jefferyyjhsu @fujitatomoya should this be backported to Jazzy? Seems important and I don't see any ABI/API issues

@fujitatomoya
Copy link
Collaborator

@Mergifyio backport jazzy

Copy link
Contributor

mergify bot commented Jan 7, 2025

backport jazzy

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jan 7, 2025
* Fix transient local publish when inter and intra process communications are both present.

* Apply the fix to TypeAdapted signature

* Add an executor to intra_process_inter_process_mix_transient_local test case to enable inter process publishing test

Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
(cherry picked from commit f5e08c2)
ahcorde pushed a commit that referenced this pull request Jan 7, 2025
* Fix transient local publish when inter and intra process communications are both present.

* Apply the fix to TypeAdapted signature

* Add an executor to intra_process_inter_process_mix_transient_local test case to enable inter process publishing test

Signed-off-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
(cherry picked from commit f5e08c2)

Co-authored-by: Jeffery Hsu <jefferyyjhsu@gmail.com>
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.

5 participants