Skip to content

.lock file persists after shutting down control node #2330

@c-staro

Description

@c-staro

Describe the bug
Hello,

after shutting down a ros2 node that uses ros2_control, the file "/tmp/ros2-control-controller-spawner.lock" persists and prevents other users from using ros2_control nodes. Admins can delete it, but regular users cannot.

To Reproduce
Steps to reproduce the behavior:

  1. Start a ros2 node that executes ros2_control_node
  2. Shut down the node via Ctrl+C --> tmp/ros2-control-controller-spawner.lock persists

Expected behavior
Cleanup of .lock file after shutting down, or handling it differently, so that it doesn't persist in /tmp.

Log

[spawner-4] Traceback (most recent call last):
[spawner-4]   File "/opt/ros/jazzy/lib/python3.12/site-packages/controller_manager/spawner.py", line 185, in main
[spawner-4]     lock.acquire(timeout=20)
[spawner-4]   File "/usr/lib/python3/dist-packages/filelock/_api.py", line 255, in acquire
[spawner-4]     self._acquire()
[spawner-4]   File "/usr/lib/python3/dist-packages/filelock/_unix.py", line 39, in _acquire
[spawner-4]     fd = os.open(self.lock_file, open_flags, self._context.mode)
[spawner-4]          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[spawner-4] PermissionError: [Errno 13] Permission denied: '/tmp/ros2-control-controller-spawner.lock'
[spawner-4] 
[spawner-4] During handling of the above exception, another exception occurred:
[spawner-4] 
[spawner-4] Traceback (most recent call last):
[spawner-4]   File "/opt/ros/jazzy/lib/controller_manager/spawner", line 33, in <module>
[spawner-4]     sys.exit(load_entry_point('controller-manager==4.29.0', 'console_scripts', 'spawner')())
[spawner-4]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[spawner-4]   File "/opt/ros/jazzy/lib/python3.12/site-packages/controller_manager/spawner.py", line 405, in main
[spawner-4]     node.destroy_node()
[spawner-4]     ^^^^
[spawner-4] UnboundLocalError: cannot access local variable 'node' where it is not associated with a value
[ERROR] [spawner-4]: process has died [pid 435478, exit code 1, cmd '/opt/ros/jazzy/lib/controller_manager/spawner robotiq_gripper_controller -c /controller_manager --ros-args'].

Environment:

  • OS: Ubuntu 24.04
  • Version Jazzy

I cannot say for sure if changes to the environment have been performed by some users. Maybe the issue is on our side, but I cannot figure it out.

Thanks in advance for your suggestions :).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpersistentIssue won't get marked as stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions