sonic-buildimage icon indicating copy to clipboard operation
sonic-buildimage copied to clipboard

[master] sonic-db-cli was not able to connect to CHASSIS DB when namespace is provided.

Open ysmanman opened this issue 10 months ago • 6 comments

Description

sonic-db-cli was not able to connect to CHASSIS DB in host namespace when namespace is provided:

admin@cmp217-5:/var/log$ sudo sonic-db-cli -n asic0 CHASSIS_APP_DB keys "*"
Invalid database name input : 'CHASSIS_APP_DB'
Unable to connect to redis (unix-socket): Cannot assign requested address
admin@cmp217-5:/var/log$ 

It worked fine within asic namespace (without providing namespace):

admin@cmp217-5:/var/log$ docker exec -it swss0 bash
root@cmp217-5:/# sonic-db-cli CHASSIS_APP_DB keys "*"
SYSTEM_INTERFACE|cmp217-5|asic1|Ethernet256
SYSTEM_INTERFACE|cmp217-5|asic0|Ethernet80
SYSTEM_INTERFACE|cmp217-5|asic0|Ethernet32
SYSTEM_INTERFACE|cmp217-5|asic0|Ethernet-IB0
SYSTEM_LAG_ID_START
SYSTEM_INTERFACE|cmp217-5|asic0|Ethernet24
SYSTEM_INTERFACE|cmp217-5|asic1|Ethernet216
SYSTEM_INTERFACE|cmp217-5|asic1|Ethernet224
SYSTEM_LAG_ID_END
SYSTEM_NEIGH|cmp217-5|asic1|Ethernet-IB1|10.0.254.3
SYSTEM_NEIGH|cmp217-5|asic0|Ethernet-IB0|10.0.254.1
SYSTEM_INTERFACE|cmp217-5|asic0|Ethernet88
SYSTEM_INTERFACE|cmp217-5|asic0|Ethernet40
SYSTEM_NEIGH|cmp217-5|asic1|Ethernet-IB1|fc00:3000::3
SYSTEM_NEIGH|cmp217-5|asic0|Ethernet-IB0|fc00:3000::1
SYSTEM_INTERFACE|cmp217-5|asic1|Ethernet176
SYSTEM_INTERFACE|cmp217-5|asic1|Ethernet-IB1
SYSTEM_INTERFACE|cmp217-5|asic1|Ethernet184
SYSTEM_INTERFACE|cmp217-5|asic1|Ethernet-Rec1
SYSTEM_INTERFACE|cmp217-5|asic1|Ethernet248
SYSTEM_INTERFACE|cmp217-5|asic1|Ethernet144
SYSTEM_INTERFACE|cmp217-5|asic0|Ethernet-Rec0
root@cmp217-5:/# 

Steps to reproduce the issue:

Describe the results you received:

Describe the results you expected:

Output of show version:

(paste your output here)

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

ysmanman avatar Apr 19 '24 22:04 ysmanman

This seems a regression introduced by https://github.com/sonic-net/sonic-swss-common/pull/797. Before this PR, sonic-db-cli use tcp socket to connect to CHASSIS DBs by default. But with this PR, now it always uses unix socket when namespace is provided.

ysmanman avatar Apr 19 '24 22:04 ysmanman

Add @kenneth-arista @arista-nwolfe @arlakshm for viz.

ysmanman avatar Apr 19 '24 22:04 ysmanman

Afte PR797, behaviours has been changed.

  1. Question and confusion: If command "sonic-db-cli -n asic0 STATE_DB PING " means from localhost to ping asic0 STATE_DB, what does it mean by "sonic-db-cli -n asic0 CHASSIS_STATE_DB PING"? Are we ping asic0 CHASSIS_STATE_DB from local host? There is NO CHASSIS_STATE_DB in asic0 namespace. Should PING failure be expected?

  2. If we want to allow to PING/access CHASSIS_STATE_DB regardless of "sonic-db-cli" with any asic instance ID specified in the specified in command line, then this issue needs to be addressed.

I have fixed one case with PR https://github.com/sonic-net/sonic-swss-common/pull/866 : "sonic-db-cli -n asic0 PING" which is in the database.sh. In our private branch, we temporarily address this issue by modifying the swss.sh to use sonic-db-cli without asic instance when it wants to access CHASSIS DB.

mlok-nokia avatar Apr 24 '24 15:04 mlok-nokia

The issue will be discussed in chassis meeting.

bingwang-ms avatar Apr 24 '24 16:04 bingwang-ms

Some related history: https://github.com/sonic-net/sonic-buildimage/pull/7002

kenneth-arista avatar May 01 '24 17:05 kenneth-arista

Additional related history: https://github.com/sonic-net/sonic-buildimage/pull/17962

kenneth-arista avatar May 01 '24 18:05 kenneth-arista

https://github.com/sonic-net/sonic-swss-common/pull/883 also merged

wenyiz2021 avatar Aug 22 '24 17:08 wenyiz2021