Skip to content

Use filelock in spawner to avoid concurrent operations #2202

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

Merged

Conversation

saikishor
Copy link
Member

@saikishor saikishor commented Apr 23, 2025

Use filelock to avoid concurrent operations when launching more spawners at system startup and this should make it more robust.

I've tested spawning 30+ controllers with ros2_control_demos branch test/use/filelock/spawner, with this fix it works 10 out of 10 times and without this, it didn't even work once

Needs ros/rosdistro#45306

Copy link

@doterkuile doterkuile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested this PR on a robotic platform with 15 controllers spawning. The master version failed 20% of the times. With this PR there was 50/50 success rate.

@saikishor saikishor marked this pull request as ready for review April 24, 2025 16:01
Copy link

codecov bot commented Apr 30, 2025

Codecov Report

Attention: Patch coverage is 78.12500% with 7 lines in your changes missing coverage. Please review.

Project coverage is 89.09%. Comparing base (74cb0f0) to head (a169861).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
controller_manager/controller_manager/spawner.py 78.12% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2202      +/-   ##
==========================================
- Coverage   89.14%   89.09%   -0.05%     
==========================================
  Files         139      139              
  Lines       16124    16142      +18     
  Branches     1389     1390       +1     
==========================================
+ Hits        14373    14381       +8     
- Misses       1222     1229       +7     
- Partials      529      532       +3     
Flag Coverage Δ
unittests 89.09% <78.12%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
controller_manager/controller_manager/spawner.py 73.54% <78.12%> (-0.91%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @saikishor and also @doterkuile for the notes on testing!

@bmagyar bmagyar merged commit bd1dffa into ros-controls:master May 1, 2025
23 of 25 checks passed
@bmagyar bmagyar deleted the use/filelock/spawner branch May 1, 2025 13:22
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.

4 participants