Skip to content

Fix lifecycle manager deadlock during shutdown#5438

Merged
SteveMacenski merged 2 commits intomainfrom
claude/issue-5437-20250811_174800
Aug 11, 2025
Merged

Fix lifecycle manager deadlock during shutdown#5438
SteveMacenski merged 2 commits intomainfrom
claude/issue-5437-20250811_174800

Conversation

@SteveMacenski
Copy link
Member

This PR fixes the lifecycle manager deadlock issue described in #5437.

Changes

  • Add stop() method to ServiceClient that cancels internal executor operations
  • Call stop() in LifecycleServiceClient destructor to prevent deadlock

Problem Addressed

When CTRL+C is pressed during lifecycle node bringup, a race condition can cause spin_until_future_complete to hang indefinitely as bringup and shutdown sequences run concurrently.

Solution

The stop() method cancels any running spin operations on the internal executor, allowing proper shutdown coordination.

Closes #5437

Generated with Claude Code

Add stop() method to ServiceClient that cancels internal executor operations
and call it in LifecycleServiceClient destructor to prevent deadlock when
CTRL+C is pressed during lifecycle node bringup.

This addresses issue #5437 where spin_until_future_complete can hang
indefinitely during shutdown when bringup and shutdown sequences run
concurrently.

Co-authored-by: Steve Macenski <SteveMacenski@users.noreply.github.com>
@mergify
Copy link
Contributor

mergify bot commented Aug 11, 2025

@SteveMacenski, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>
@SteveMacenski SteveMacenski merged commit f7b6654 into main Aug 11, 2025
11 of 14 checks passed
@SteveMacenski SteveMacenski deleted the claude/issue-5437-20250811_174800 branch August 11, 2025 21:10
mergify bot pushed a commit that referenced this pull request Aug 11, 2025
* Fix lifecycle manager deadlock during shutdown

Add stop() method to ServiceClient that cancels internal executor operations
and call it in LifecycleServiceClient destructor to prevent deadlock when
CTRL+C is pressed during lifecycle node bringup.

This addresses issue #5437 where spin_until_future_complete can hang
indefinitely during shutdown when bringup and shutdown sequences run
concurrently.

Co-authored-by: Steve Macenski <SteveMacenski@users.noreply.github.com>

* Update service_client.hpp

Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>

---------

Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
(cherry picked from commit f7b6654)
SteveMacenski added a commit that referenced this pull request Aug 11, 2025
* Fix lifecycle manager deadlock during shutdown

Add stop() method to ServiceClient that cancels internal executor operations
and call it in LifecycleServiceClient destructor to prevent deadlock when
CTRL+C is pressed during lifecycle node bringup.

This addresses issue #5437 where spin_until_future_complete can hang
indefinitely during shutdown when bringup and shutdown sequences run
concurrently.



* Update service_client.hpp



---------



(cherry picked from commit f7b6654)

Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>
Co-authored-by: Steve Macenski <stevenmacenski@gmail.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
BCKSELFDRIVEWORLD pushed a commit to BCKSELFDRIVEWORLD/navigation2 that referenced this pull request Sep 23, 2025
* Fix lifecycle manager deadlock during shutdown

Add stop() method to ServiceClient that cancels internal executor operations
and call it in LifecycleServiceClient destructor to prevent deadlock when
CTRL+C is pressed during lifecycle node bringup.

This addresses issue ros-navigation#5437 where spin_until_future_complete can hang
indefinitely during shutdown when bringup and shutdown sequences run
concurrently.

Co-authored-by: Steve Macenski <SteveMacenski@users.noreply.github.com>

* Update service_client.hpp

Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>

---------

Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
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.

Lifecycle manager deadlock when shutting down during bringup

1 participant