Skip to content
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

Refactor ledd daemon and fix high CPU usage due to unexpected socket … #548

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

prgeor
Copy link
Collaborator

@prgeor prgeor commented Oct 10, 2024

…close

Description

[ledd] Refactor ledd daemon and fix high CPU usage due to unexpected redis DB socket close

Motivation and Context

For unkown reason if redis closes the socket, then ledd daemon is continuously busy waiting for socket event and failing all the time. This is resulting in high CPI

How Has This Been Tested?

Close the socket abruptly and see ledd daemon is respawned so that new socket connection is established to redis DB without causing high CPU

Additional Information (Optional)

@prgeor prgeor requested a review from Staphylo October 10, 2024 21:35
@prgeor
Copy link
Collaborator Author

prgeor commented Oct 10, 2024

@Staphylo could you please help review?

@prgeor
Copy link
Collaborator Author

prgeor commented Oct 17, 2024

@assrinivasan @vvolam please review

@vvolam
Copy link

vvolam commented Oct 18, 2024

@prgeor nit: spelling issue in PR description.

image

Also, could you fix the build failure?


if state != swsscommon.Select.OBJECT:
self.log_warning("sel.select() did not return swsscommon.Select.OBJECT - May be socket closed???")
return -1 ## Fail here so that the daemon can be restarted
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider return code = (128+non-zero-code) per all other daemons code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@assrinivasan do you know the reason for 128+ ?

Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that we use 128+[non-zero code] so that supervisor can restart the daemon. Since your comment in line 118 indicates that the daemon would need to be restarted, I suggested this change.

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.

3 participants