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

[Chassis][multiasic] Fix the sonic-db-cli core files issue on multiasic platform after the c++ implementation of sonic-db-cli #13207

Merged
merged 1 commit into from
Feb 21, 2023

Conversation

mlok-nokia
Copy link
Contributor

Why I did it

Fixe #12047. After the c++ implementation of the sonic-db-cli, sonic-db-cli PING command tries to initialize the global database for all instances database starting. If all instance database-config.json are not ready yet. it will crash and generate core file. PR sonic-net/sonic-swss-common#701 only fix the crash and the process abortion. With this PR, many core files are still generated:
The following error are logged in the syslog

Dec 28 16:44:34.811893 ixre-cpm-chassis8 ERR sonic-db-cli: :- parseDatabaseConfig: Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json
Dec 28 16:44:34.812099 ixre-cpm-chassis8 ERR sonic-db-cli: :- initializeGlobalConfig: Sonic database config file syntax error >> Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json
Dec 28 16:44:34.812162 ixre-cpm-chassis8 INFO database.sh[5764]: terminate called after throwing an instance of 'std::runtime_error'
Dec 28 16:44:34.812215 ixre-cpm-chassis8 INFO database.sh[5764]:   what():  Sonic database config file syntax error >> Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json

The following core files are generated

admin@supervisor:~$ ls /var/core -al
total 376
drwxr-xr-x 1 root root 4096 Nov 22 22:00 .
drwxr-xr-x 1 root root 4096 Nov 22 20:50 ..
-rw-r--r-- 1 root root 88525 Nov 22 21:42 sonic-db-cli.1669153338.6192.core.gz
-rw-r--r-- 1 root root 93392 Nov 22 21:42 sonic-db-cli.1669153339.6757.core.gz
-rw-r--r-- 1 root root 93413 Nov 22 21:42 sonic-db-cli.1669153339.6886.core.gz
-rw-r--r-- 1 root root 93284 Nov 22 21:42 sonic-db-cli.1669153339.7072.core.gz

How I did it

In the database.sh, call function waitForAllInstanceDatabaseConfigJsonFilesReady to make sure all instance database-config.json are present before the command sonic-db-cli PING. This will avoid the database-config,json doesn't exist and cause errors and generate the core file.

How to verify it

With this change, after the image install and boot up, check and verify the syslog, the following lines should not be in the syslog and this related core file should not be seen.
'''
Dec 28 16:44:34.811893 ixre-cpm-chassis8 ERR sonic-db-cli: :- parseDatabaseConfig: Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json
Dec 28 16:44:34.812099 ixre-cpm-chassis8 ERR sonic-db-cli: :- initializeGlobalConfig: Sonic database config file syntax error >> Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json
Dec 28 16:44:34.812162 ixre-cpm-chassis8 INFO database.sh[5764]: terminate called after throwing an instance of 'std::runtime_error'
Dec 28 16:44:34.812215 ixre-cpm-chassis8 INFO database.sh[5764]: what(): Sonic database config file syntax error >> Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json
'''

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211

Description for the changelog

Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@mlok-nokia mlok-nokia requested a review from lguohan as a code owner December 30, 2022 21:00
@mlok-nokia
Copy link
Contributor Author

@rlhui @judyjoseph @abdosi After 202205 branch uses the c++ implementation of the sonic-db-cli, even with PR sonic-net/sonic-swss-common#701, database.sh still generates many core files. This PR will address this core files issue. Please review it.

@rlhui rlhui requested a review from judyjoseph December 31, 2022 05:05
@rlhui rlhui added the Chassis 🤖 Modular chassis support label Dec 31, 2022
@qiluo-msft qiluo-msft requested a review from liuh-80 January 12, 2023 21:57
# sonic-db-cli try to initialize the global database. If in multiasic platform, inital global
# database will try to access to all other instance database-config.json. If other instance
# database-config.json files are not ready yet, it will generate the sonic-db-cli core files.
waitForAllInstanceDatabaseConfigJsonFilesReady
Copy link
Contributor

Choose a reason for hiding this comment

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

The crash is not cause by a behavior change, python version sonic-db-cli also crash in this case, access name space DB need name space config file ready.

@qiluo-msft
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@qiluo-msft
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mlok-nokia mlok-nokia force-pushed the fix-sonic-db-cli-core branch from 871c6ef to a47d0ec Compare February 14, 2023 18:17
…ic platform after the c++ implementation of sonic-db-cli

Signed-off-by: mlok <marty.lok@nokia.com>
@mlok-nokia mlok-nokia force-pushed the fix-sonic-db-cli-core branch from a47d0ec to 9f36c25 Compare February 14, 2023 18:23
@judyjoseph
Copy link
Contributor

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mlok-nokia
Copy link
Contributor Author

This PR needs to be marked "request for 202205"

@stepanblyschak
Copy link
Collaborator

@mlok-nokia @judyjoseph Please add request for 202211

mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Mar 6, 2023
…ic platform after the c++ implementation of sonic-db-cli (sonic-net#13207)

Fixe sonic-net#12047. After the c++ implementation of the sonic-db-cli, sonic-db-cli PING command tries to initialize the global database for all instances database starting. If all instance database-config.json are not ready yet. it will crash and generate core file. PR sonic-net/sonic-swss-common#701 only fix the crash and the process abortion. 

Signed-off-by: mlok <marty.lok@nokia.com>
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202205: #14108

mssonicbld pushed a commit that referenced this pull request Mar 7, 2023
…ic platform after the c++ implementation of sonic-db-cli (#13207)

Fixe #12047. After the c++ implementation of the sonic-db-cli, sonic-db-cli PING command tries to initialize the global database for all instances database starting. If all instance database-config.json are not ready yet. it will crash and generate core file. PR sonic-net/sonic-swss-common#701 only fix the crash and the process abortion. 

Signed-off-by: mlok <marty.lok@nokia.com>
@mlok-nokia mlok-nokia deleted the fix-sonic-db-cli-core branch September 27, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

8 participants