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

[iron] Gracefully handle SIGINT and SIGTERM in rosbag2 recorder (backport #1301) #1394

Merged
merged 1 commit into from Jun 14, 2023

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Jun 13, 2023

This is an automatic backport of pull request #1301 done by Mergify.


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com

* Gracefully handle SIGINT and SIGTERM signal for rosbag2 recorder

- Call recorder->stop() and exec_->cancel() instead of rclcpp::shutdown

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

* Use singleton for static executor in the rosbag2_py::Recorder

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

* Rollback to the non-static executor and don't call executor->cancel()

- In case when signal will arrive we will trigger our internal exit_
variable and wait while current exec_->spin_all(10msec) will exit.

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

* Spin recorder node in a separate thread for better handling exit

- Run exec->spin() in a separate thread, because we need to call
exec->cancel() after recorder->stop() to be able to send notifications
about bag split and close.
- Wait on conditional variable for exit_ flag

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

* Address race condition in rosbag2_py.test_record_cancel

- Add `record_thread.join()` before trying to parse metadata.

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

---------

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 46a23e9)
@mergify mergify bot requested a review from a team as a code owner June 13, 2023 06:22
@mergify mergify bot requested review from emersonknapp and james-rms and removed request for a team June 13, 2023 06:22
@MichaelOrlov MichaelOrlov changed the title Gracefully handle SIGINT and SIGTERM in rosbag2 recorder (backport #1301) [iron] Gracefully handle SIGINT and SIGTERM in rosbag2 recorder (backport #1301) Jun 13, 2023
@MichaelOrlov
Copy link
Contributor

Gist: https://gist.githubusercontent.com/MichaelOrlov/8c4000f9f1873c8036c26eeab5853a76/raw/2f9d4cc37579cff174f4bd5ef80b2cde0ee59750/ros2.repos
BUILD args: --packages-above-and-dependencies rosbag2_py rosbag2_tests
TEST args: --packages-above rosbag2_py rosbag2_tests
ROS Distro: iron
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/12220

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

@MichaelOrlov
Copy link
Contributor

The test failure on Windows in the launch_testing_examples.launch_testing_examples.check_node_launch_test.launch_testing_examples.check_node_launch_test with error message

=========================================================================================================================================================
FAIL: launch_testing_examples.check_node_launch_test.TestFixture.test_node_start
---------------------------------------------------------------------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\ci\ws\src\ros2\examples\launch_testing\launch_testing_examples\launch_testing_examples\check_node_launch_test.py", line 48, in test_node_start
    rclpy.init()
  File "C:\ci\ws\install\Lib\site-packages\rclpy\__init__.py", line 89, in init
    return context.init(args, domain_id=domain_id)
  File "C:\ci\ws\install\Lib\site-packages\rclpy\context.py", line 70, in init
    raise RuntimeError('Context.init() must only be called once')
RuntimeError: Context.init() must only be called once

seems unrelated
re-running CI

  • Windows Build Status

@MichaelOrlov MichaelOrlov merged commit 5bc6122 into iron Jun 14, 2023
14 checks passed
@delete-merged-branch delete-merged-branch bot deleted the mergify/bp/iron/pr-1301 branch June 14, 2023 07:38
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.

None yet

2 participants