-
Notifications
You must be signed in to change notification settings - Fork 86
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
Exception seen when trying to connect and database service is not responding #72
Comments
@dzhangalibaba Can you please take a look at this.
|
Thanks finding that, will raise a PR to fix it. |
please help review the fix |
Another related issue.. When the database docker is down, the sonic-db-cli eternally waits for a response. Whereas redis-cli immediately errors out. I think we would want to bring in this parity.
Apart from the above, maybe add another -p option for a continuous retry? Comments? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
root@sonic:/home/admin# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@sonic:/home/admin#
2 Now try to initiate a connection with retry option. A py exception is observed.
root@sonic:/home/admin# cat test.py
#!/usr/bin/env python2.7
from swsssdk import SonicV2Connector
state_db = SonicV2Connector(host='17.0.0.1')
state_db.connect(state_db.STATE_DB,True)
root@sonic:/home/admin#
root@sonic:/home/admin# ./test.py
Traceback (most recent call last):
File "./test.py", line 5, in
state_db.connect(state_db.STATE_DB,True)
File "/usr/local/lib/python2.7/dist-packages/swsssdk/dbconnector.py", line 255, in connect
super(SonicV2Connector, self).connect(db_id, retry_on)
File "/usr/local/lib/python2.7/dist-packages/swsssdk/interface.py", line 169, in connect
self._persistent_connect(db_id)
File "/usr/local/lib/python2.7/dist-packages/swsssdk/interface.py", line 198, in _persistent_connect
self.close(db_id)
File "/usr/local/lib/python2.7/dist-packages/swsssdk/dbconnector.py", line 258, in close
db_id = self.get_dbid(db_name)
File "/usr/local/lib/python2.7/dist-packages/swsssdk/dbconnector.py", line 277, in get_dbid
return SonicDBConfig.get_dbid(db_name, self.namespace)
File "/usr/local/lib/python2.7/dist-packages/swsssdk/dbconnector.py", line 215, in get_dbid
SonicDBConfig.db_name_validation(db_name, namespace)
File "/usr/local/lib/python2.7/dist-packages/swsssdk/dbconnector.py", line 143, in db_name_validation
raise RuntimeError(msg)
RuntimeError: 6 is not a valid database name in configuration file
root@sonic:/home/admin#
The text was updated successfully, but these errors were encountered: