Skip to content

fix(test_events_executor): destroy all nodes before shutdown (backport #1538)#1541

Closed
mergify[bot] wants to merge 1 commit intohumblefrom
mergify/bp/humble/pr-1538
Closed

fix(test_events_executor): destroy all nodes before shutdown (backport #1538)#1541
mergify[bot] wants to merge 1 commit intohumblefrom
mergify/bp/humble/pr-1538

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Nov 7, 2025

Description

This closes ros2/rmw_zenoh#852. rmw_zenoh failed to pass the test since the publisher declared in test_async_sub was accidentally detected by the subsequent test_pub_sub (the tests run in alphabetical order). The root cause is that the publisher node is not explicitly destroyed during the rclpy shutdown.

To clarify, this behavior stems from the different mechanism used in rmw_zenoh compared to other DDS implementations. Specifically, the shutdown of rmw_zenoh doesn't immediately close the Zenoh session as long as other nodes are still alive. This aligns with the RMW philosophy that nodes and their associated entities such as publishers, subscriptions, and so on, are not explicitly destroyed by rmw_shutdown.

Introduing a sleep after rclpy.shutdown does not solve the issue because the node data remain referenced until the object destruction phase. Meanwhile, the next test begins immediately and reads the stale liveliness token, causing the test to fail.

This fix adotps the approach used in other tests by explicitly cleaning up the nodes to avoid such stale references.

Is this user-facing behavior change?

Did you use Generative AI?

Additional Information

Signed-off-by: yuanyuyuan <az6980522@gmail.com>
(cherry picked from commit 162021a)

# Conflicts:
#	rclpy/test/test_events_executor.py
@mergify
Copy link
Copy Markdown
Contributor Author

mergify bot commented Nov 7, 2025

Cherry-pick of 162021a has failed:

On branch mergify/bp/humble/pr-1538
Your branch is up to date with 'origin/humble'.

You are currently cherry-picking commit 162021a.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	deleted by us:   rclpy/test/test_events_executor.py

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants