fix: release EtherCAT master in EcMaster destructor#221
Open
apajon wants to merge 1 commit intoICube-Robotics:jazzyfrom
Open
fix: release EtherCAT master in EcMaster destructor#221apajon wants to merge 1 commit intoICube-Robotics:jazzyfrom
EcMaster destructor#221apajon wants to merge 1 commit intoICube-Robotics:jazzyfrom
Conversation
Call ecrt_release_master() in ~EcMaster() to properly release the kernel EtherCAT master device. Without this, the master remains locked after the process exits, preventing re-initialization on restart without unloading the kernel module. This is especially critical in multi-master setups where multiple EcMaster instances coexist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The current
jazzybranch correctly defersEcMasterinitialization, so multi-master setups usingmaster_idare already supported.However,
EcMasterdoes not explicitly release the IgH master in its destructor. This can leave the master reserved after shutdown and may interfere with clean restart or re-acquisition.Solution
Add an explicit
ecrt_release_master(master_)call in~EcMaster():This ensures proper cleanup and symmetry with
ecrt_request_master().Impact
Why this PR
This PR intentionally focuses on a minimal and isolated fix for proper resource cleanup in the current
jazzybranch.Testing
Validated in a real setup (ROS2 Jazzy / Ubuntu 24.04) with repeated startup / shutdown cycles on a multi-bus EtherCAT configuration.