-
Notifications
You must be signed in to change notification settings - Fork 156
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
Enhance port_update_event logic to be thread-safe #430
Merged
prgeor
merged 9 commits into
sonic-net:master
from
longhuan-cisco:port_mapping_multi_thread_fix
Feb 23, 2024
Merged
Enhance port_update_event logic to be thread-safe #430
prgeor
merged 9 commits into
sonic-net:master
from
longhuan-cisco:port_mapping_multi_thread_fix
Feb 23, 2024
Conversation
This file contains 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
prgeor
reviewed
Feb 8, 2024
longhuan-cisco
changed the title
Enhance port_mapping to be thread-safe
Enhance port_update_event logic to be thread-safe
Feb 13, 2024
prgeor
previously approved these changes
Feb 16, 2024
mihirpat1
approved these changes
Feb 16, 2024
prgeor
reviewed
Feb 19, 2024
prgeor
reviewed
Feb 19, 2024
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
prgeor
approved these changes
Feb 23, 2024
noaOrMlnx
pushed a commit
to noaOrMlnx/sonic-platform-daemons
that referenced
this pull request
Mar 14, 2024
* Enhance port_mapping to be multi-thread safe * Increase cov for handle_port_update_event test in test_xcvrd.py * Fix comment in test_xcvrd.py * Migrate to PortChangeObserver class to handle port update events * Rename port_mapping.py to port_event_helper.py * Remove unused import statement in port_event_helper.py * Resolve issue after update branch to latest master
vivekrnv
pushed a commit
to vivekrnv/sonic-platform-daemons
that referenced
this pull request
Mar 22, 2024
* Enhance port_mapping to be multi-thread safe * Increase cov for handle_port_update_event test in test_xcvrd.py * Fix comment in test_xcvrd.py * Migrate to PortChangeObserver class to handle port update events * Rename port_mapping.py to port_event_helper.py * Remove unused import statement in port_event_helper.py * Resolve issue after update branch to latest master
yuazhe
pushed a commit
to yuazhe/sonic-platform-daemons
that referenced
this pull request
Jul 2, 2024
* Enhance port_mapping to be multi-thread safe * Increase cov for handle_port_update_event test in test_xcvrd.py * Fix comment in test_xcvrd.py * Migrate to PortChangeObserver class to handle port update events * Rename port_mapping.py to port_event_helper.py * Remove unused import statement in port_event_helper.py * Resolve issue after update branch to latest master
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.
Description
subscribe_port_update_event/handle_port_update_event
logic to be object oriented, which is also thread-safe.DEL
events from different tables/DBs, user may have different handlings.)Motivation and Context
Today's port_mapping has a class variable
PORT_EVENT
, which is not thread-safe: different threads could share this class level global variable PORT_EVENT, and overwriting each other's data.It's not causing issue in today's code, because today only one thread (cmis_mgr) relying on port_mapping.handle_port_update_event (and PORT_EVENT).
But in the future, it will run into issues if multiple threads (e.g. cmis_mgr, sff_mgr, PM) rely on function port_mapping.handle_port_update_event (where PORT_EVENT is getting used)
This PR is a dependency of #383
How Has This Been Tested?
Verified cmis_mgr/sff_mgr(new thread) to be able to work normally to bring up/down optics without intervention with each other.
Additional Information (Optional)