-
Notifications
You must be signed in to change notification settings - Fork 267
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
[logger] Fix Kernel GP seen for any short-lived *syncd process #444
Merged
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
… thread_local for detached thread
qiluo-msft
reviewed
Jan 12, 2021
common/logger.h
Outdated
@@ -145,6 +145,7 @@ class Logger | |||
std::atomic<Output> m_output = { SWSS_SYSLOG }; | |||
std::unique_ptr<std::thread> m_settingThread; | |||
std::mutex m_mutex; | |||
bool terminateSettingThread = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add volatile
#Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to volatile
qiluo-msft
approved these changes
Jan 12, 2021
In the title, could you talk with the context of logger? |
vaibhavhd
changed the title
Fix Kernel GP seen for any short-lived *syncd process
[logger] Fix Kernel GP seen for any short-lived *syncd process
Jan 12, 2021
yxieca
approved these changes
Jan 12, 2021
4 tasks
lguohan
pushed a commit
to sonic-net/sonic-buildimage
that referenced
this pull request
Jan 13, 2021
…ction error fix (#6436) To include Kernel GP fault seen in *syncd processes: sonic-net/sonic-swss-common#444
lguohan
pushed a commit
to sonic-net/sonic-buildimage
that referenced
this pull request
Jan 15, 2021
…ction error fix (#6436) To include Kernel GP fault seen in *syncd processes: sonic-net/sonic-swss-common#444
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.
Fixes: sonic-net/sonic-buildimage#6103
This PR is to fix the Kernel GP errors that are seen in any short-lived process within swss.
As part of *syncd initialization,
Logger::linkToDbNative
function is called. This call starts aSettingThread
in the background.When the main *syncd process terminates the destructor
Logger::~Logger
simply detaches theSettingThread
. This leads to the detached thread's continued exection in the background.At the same time, the exiting main process deletes the static variables that were in its scope.
Fault is hit when the detached thread (still executing in the infinite loop) tries to access these freed up variables.
This issue is easily reproducible when these *syncd process are short lived (and the detached
SettingThread
is still executing). Below are the examples by simply executing thehelp
option:Sample 1 : Orchagent core and Kernel GP:
Sample 2 : Gearsyncd core and Kernel GP:
Sample 3 : portsyncd core and Kernel GP:
Fix:
SettingThread
thread.