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

Remove the error log form SonicDBConfig::initializeGlobalConfig #869

Closed
wants to merge 1 commit into from

Conversation

wumiaont
Copy link

@wumiaont wumiaont commented Apr 1, 2024

Issue: If run "show interfaces status" we often see the error in syslog "SonicDBConfig Global config is already initialized".

Analysis: During investigation it is found the swsscommon.load_sonic_global_db_config() has been triggered multiple times. Espically in a multi Asic scenario.

CLI triggers "intfutil -c status" with a separate process. Within the process it will trigger IntfStatus init --> MultiAsic() init-->load_db_config()-->load_sonic_global_db_config(). This time initializeGlobalConfig() will run to the end as m_global_init flag is false.

CLI will also run get_port_config() --> db_connect_configdb() --> load_sonic_global_db_config() (for different namepaces. In our case is asic0 and asic1). This time m_global_init flag is true which causes error log and return.

Conclusion: After researching we found load_db_config() could be called by different Classes. The code has already added protection to avoid to initialize global config multiple time. The error log is not necessary to be there.

Solution: Removed the error log from initializeGlobalConfig() when found global config is already initialized.

@wumiaont
Copy link
Author

wumiaont commented Apr 1, 2024

@deepak-singhal0408 @mlok-nokia Please help to review.

Copy link

@deepak-singhal0408 deepak-singhal0408 left a comment

Choose a reason for hiding this comment

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

LGTM..

@deepak-singhal0408
Copy link

MSFT ADO: 25516271

@wumiaont
Copy link
Author

wumiaont commented Apr 2, 2024

@deepak-singhal0408 Thanks for review. Can you help to merge the changes? I don't have permission to do that. Thanks.

@deepak-singhal0408
Copy link

Hi @qiluo-msft, could you please help review this PR? Thanks!

@@ -84,7 +84,6 @@ void SonicDBConfig::initializeGlobalConfig(const string &file)

if (m_global_init)
{
SWSS_LOG_ERROR("SonicDBConfig Global config is already initialized");
Copy link
Contributor

Choose a reason for hiding this comment

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

SWSS_LOG_ERROR

The error message is designed intentionally for application to realize there is a problem that calling initialization more than once. we need to fix application.

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

Block this PR, adding comment.

@deepak-singhal0408
Copy link

Hi @wumiaont , please have a look at this PR.. sonic-net/sonic-buildimage#10960..
Please take this change and give it a try?

@wumiaont
Copy link
Author

The issue does not happen on master. Have a fix for 202205. Please review that one. sonic-net/sonic-buildimage#18609

@wumiaont wumiaont closed this Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants