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

[sonic-db-cli] Fix sonic-db-cli crash when database config file not ready issue. #701

Merged
merged 6 commits into from
Oct 31, 2022

Conversation

liuh-80
Copy link
Contributor

@liuh-80 liuh-80 commented Oct 24, 2022

Why I did it

Fix sonic-db-cli PING/SAVE/FLUSHALL command crash when database config file not ready issue:
sonic-net/sonic-buildimage#12047

How I did it

When run PING/SAVE/FLUSHALL command, catch database initialize failed exception and return 1.

How to verify it

Pass all existing UT and E2E test.
Add new UT to cover changed code.
Manually test, sonic-db-cli will return 1 when run PING command and can't find config file:

azureuser@a7f66d2b794c:/sonic/src/sonic-swss-common$ ./sonic-db-cli/sonic-db-cli PING
An exception of type Sonic database config file doesn't exist at /var/run/redis/sonic-db/database_config.json occurred. Arguments:
/sonic/src/sonic-swss-common/sonic-db-cli/.libs/sonic-db-cli PING
azureuser@a7f66d2b794c:/sonic/src/sonic-swss-common$ echo $?
1

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

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

Description for the changelog

Fix sonic-db-cli PING/SAVE/FLUSHALL command crash when database config file not ready issue.

Link to config_db schema for YANG module changes

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

@liuh-80 liuh-80 marked this pull request as ready for review October 24, 2022 09:06
@liuh-80
Copy link
Contributor Author

liuh-80 commented Oct 25, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80
Copy link
Contributor Author

liuh-80 commented Oct 26, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80
Copy link
Contributor Author

liuh-80 commented Oct 26, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80
Copy link
Contributor Author

liuh-80 commented Oct 27, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80
Copy link
Contributor Author

liuh-80 commented Oct 27, 2022

This PR (and all sonic-swss-common) PR blocked by validation break, which because change in sonic-net/sonic-sairedis#1116

@saiarcot895
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@saiarcot895
Copy link
Contributor

That PR has been reverted due to tests becoming potentially flaky.

@liuh-80
Copy link
Contributor Author

liuh-80 commented Oct 28, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80 liuh-80 merged commit 276f47c into sonic-net:master Oct 31, 2022
@liuh-80 liuh-80 deleted the dev/liuh/fix-db-cli branch October 31, 2022 02:25
yxieca pushed a commit that referenced this pull request Nov 3, 2022
…eady issue. (#701)

#### Why I did it
Fix sonic-db-cli  PING/SAVE/FLUSHALL command crash when database config file not ready issue:
sonic-net/sonic-buildimage#12047

#### How I did it
When run PING/SAVE/FLUSHALL command, catch database initialize failed exception and return 1.

#### How to verify it
Pass all existing UT and E2E test.
Add new UT to cover changed code.
Manually test, sonic-db-cli will return 1 when run PING command and can't find config file:

azureuser@a7f66d2b794c:/sonic/src/sonic-swss-common$ ./sonic-db-cli/sonic-db-cli PING
An exception of type Sonic database config file doesn't exist at /var/run/redis/sonic-db/database_config.json occurred. Arguments:
/sonic/src/sonic-swss-common/sonic-db-cli/.libs/sonic-db-cli PING
azureuser@a7f66d2b794c:/sonic/src/sonic-swss-common$ echo $?
1


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

<!--
- Note we only backport fixes to a release branch, *not* features!
- Please also provide a reason for the backporting below.
- e.g.
- [x] 202006
-->

- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012
- [ ] 202106
- [x] 202111
- [x] 202205

#### Description for the changelog
Fix sonic-db-cli  PING/SAVE/FLUSHALL command crash when database config file not ready issue.

#### Link to config_db schema for YANG module changes
<!--
Provide a link to config_db schema for the table for which YANG model
is defined
Link should point to correct section on https://github.com/Azure/SONiC/wiki/Configuration.
-->

#### A picture of a cute animal (not mandatory but encouraged)
rlhui pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Feb 21, 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>
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 pushed a commit to sonic-net/sonic-buildimage 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants