[xcvrd] Fix outdated state machine comments for SYSTEM_NOT_READY event#821
Open
kevin94chen wants to merge 1 commit into
Open
[xcvrd] Fix outdated state machine comments for SYSTEM_NOT_READY event#821kevin94chen wants to merge 1 commit into
kevin94chen wants to merge 1 commit into
Conversation
|
|
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
541ff1f to
6fb09ec
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
The comments in xcvrd.py describing the state machine transition for the SYSTEM_NOT_READY event while in the NORMAL state were outdated. The comments previously indicated that the daemon would transition back to the INIT state. However, the actual implementation safely treats this condition as a fatal error and transitions to the EXIT state, relying on supervisord to cleanly restart the daemon. This commit updates the comments to align with the actual code behavior to prevent developer confusion. Signed-off-by: kevin94chen <kevin94chen@gmail.com>
6fb09ec to
a0fabc7
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates documentation in sonic-xcvrd to reflect the actual xcvrd state-machine behavior when receiving SYSTEM_NOT_READY while in the NORMAL state (fail-fast to EXIT, relying on supervisord restart), reducing developer confusion when reading the transceiver monitoring loop.
Changes:
- Corrected the
SYSTEM_NOT_READY→ next-state documentation for theNORMALstate fromINITtoEXIT. - Updated the state transition table comment to match the implemented
NORMAL+SYSTEM_NOT_READY→EXITbehavior.
| # max retry reached, treat as fatal, transition to EXIT | ||
| # - NORMAL | ||
| # Treat as an error, transition to INIT | ||
| # Treat as fatal, transition to EXIT |
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.
Description
The comments in xcvrd.py describing the state machine transition for the SYSTEM_NOT_READY event while in the NORMAL state were outdated.
The comments previously indicated that the daemon would transition back to the INIT state. However, the actual implementation safely treats this condition as a fatal error and transitions to the EXIT state, relying on supervisord to cleanly restart the daemon.
This commit updates the comments to align with the actual code behavior to prevent developer confusion.
Motivation and Context
Why is this change required? What problem does it solve? The contradiction between the state machine documentation (comments) and the actual source code logic caused confusion for developers reading the codebase. By aligning the comments with the code's intended fail-fast design (
treat as fatal. Exiting...), this PR improves code readability and maintainability.How Has This Been Tested?
This is a comment-only change that aligns documentation with existing behavior. No functional code modifications were made.
Additional Information (Optional)