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

ConfigDBPipeConnector_Native_get_config fails if CONFIG_DB_UPDATED string key exists in CONFIG_DB #467

Open
kakkotetsu opened this issue Mar 17, 2021 · 0 comments

Comments

@kakkotetsu
Copy link

summary

"CONFIG_DB_UPDATED" string key is inserted in CONFIG_DB after changing settings in RESTCONF. ( https://github.com/Azure/sonic-mgmt-common/blob/master/translib/db/db.go#L1421 )
If this key is present, ConfigDBPipeConnector_Native_get_config fails.

procedure for reproducing

  • environment
admin@sonic:~$ show version

SONiC Software Version: SONiC.202012.0-08307385
Distribution: Debian 10.8
Kernel: 4.19.0-12-2-amd64
Build commit: 08307385
Build date: Wed Mar 10 03:10:26 UTC 2021
Built by: tetsuji@kf1-AF13sv001

Platform: x86_64-dellemc_s5248f_c3538-r0
HwSKU: DellEMC-S5248f-P-25G
ASIC: broadcom
ASIC Count: 1
...<snip>
  • update config with RESTCONF (it's example)
$ curl -s -X POST -H 'Content-Type:application/yang-data+json' -H 'Accept:application/yang-data+json' --insecure  'https://<sonic ip address>/restconf/data/sonic-interface:sonic-interface/INTERFACE' -d '{"sonic-interface:INTERFACE_LIST": [{"portname": "Ethernet1"}], "sonic-interface:INTERFACE_IPADDR_LIST": [{"portname": "Ethernet1","ip_prefix": "172.30.128.2/31"}]}'
  • sonic-cfggen fails in _swsscommon.ConfigDBPipeConnector_Native_get_config(self)
admin@sonic:~$ sonic-cfggen -d
Traceback (most recent call last):
  File "/usr/local/bin/sonic-cfggen", line 432, in <module>
    main()
  File "/usr/local/bin/sonic-cfggen", line 361, in main
    deep_update(data, FormatConverter.db_to_output(configdb.get_config()))
  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 2087, in get_config
    data = super(ConfigDBConnector, self).get_config()
  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 2117, in get_config
    return _swsscommon.ConfigDBPipeConnector_Native_get_config(self)
RuntimeError: Got unexpected result: Input/output error
  • DELete string keys "CONFIG_DB_UPDATED_*", then get well
admin@sonic:~$ redis-cli -n 4
127.0.0.1:6379[4]> KEYS CONFIG_*
1) "CONFIG_DB_UPDATED_INTERFACE"
2) "CONFIG_DB_INITIALIZED"
3) "CONFIG_DB_UPDATED"

127.0.0.1:6379[4]> TYPE CONFIG_DB_UPDATED_INTERFACE
string
127.0.0.1:6379[4]> HGETALL CONFIG_DB_UPDATED_INTERFACE
(error) WRONGTYPE Operation against a key holding the wrong kind of value
127.0.0.1:6379[4]> GET CONFIG_DB_UPDATED_INTERFACE
"1"

127.0.0.1:6379[4]> TYPE CONFIG_DB_UPDATED
string
127.0.0.1:6379[4]> HGETALL CONFIG_DB_UPDATED
(error) WRONGTYPE Operation against a key holding the wrong kind of value
127.0.0.1:6379[4]> GET CONFIG_DB_UPDATED
"1"

127.0.0.1:6379[4]> DEL CONFIG_DB_UPDATED_INTERFACE
(integer) 1
127.0.0.1:6379[4]> DEL CONFIG_DB_UPDATED
(integer) 1
127.0.0.1:6379[4]> KEYS CONFIG_*
1) "CONFIG_DB_INITIALIZED"
127.0.0.1:6379[4]> exit

admin@sonic:~$ sonic-cfggen -d --print-data | more
{
    "CRM": {
        "Config": {
            "acl_counter_high_threshold": "85",
...<snip>
qiluo-msft pushed a commit that referenced this issue May 11, 2021
swss-common: Fix config save error for non-hash key

- Fixing #467
- Cleanup #465
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant