[dhcp_relay] add retry to checking process dhcprelayd#25470
Merged
yxieca merged 1 commit intosonic-net:masterfrom Mar 21, 2026
Merged
[dhcp_relay] add retry to checking process dhcprelayd#25470yxieca merged 1 commit intosonic-net:masterfrom
yxieca merged 1 commit intosonic-net:masterfrom
Conversation
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Xichen Lin <lukelin0907@gmail.com>
89abea4 to
e8961b2
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates dhcprelayd’s process-checking logic to reduce failures caused by transient psutil exceptions when reading process metadata, aiming to avoid unnecessary dhcp_relay container restarts.
Changes:
- Add a retry loop around
psutilprocess inspection (proc.name()/ppid()/cmdline()) in_check_dhcp_relay_processes. - Re-raise the last encountered exception after retrying up to 5 times.
Blueve
approved these changes
Feb 26, 2026
Contributor
Author
|
@yxieca Hi Ying, please help review and merge this pr |
Contributor
|
AI agent on behalf of Ying: Reviewed the change in dhcprelayd.py. The retry loop looks reasonable, but consider adding a small backoff sleep between retries to avoid tight looping when psutil hits transient errors. Also consider narrowing the retried exception types (for example AccessDenied vs unexpected exceptions) so we do not mask real bugs. Otherwise looks fine. |
Contributor
Author
|
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.
Why I did it
Occasionally, the psutil lib will through error when trying to read name. Retrying fix the problem.
Work item tracking
How I did it
Retry the operation
How to verify it
Applied it on production machine and fixed the issue
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)