Skip to content

Commit

Permalink
- What I did
Browse files Browse the repository at this point in the history
In a dynamic environment, it is possible that some of the keys may
disappear between invoking keys() and get_all().
Prevent unnecessary timeout of blocking get_all().
Add more snmp no blocking fix for sonic-net#255

- How I did it
Modify the blocking mode from True to False

- How to verify it
Use server to send with 1000 requests/second. Keep test for weekend and it do not happen.
  • Loading branch information
ecsonic committed May 6, 2024
1 parent f652948 commit 5c955f0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/sonic_ax_impl/mibs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def init_mgmt_interface_tables(db_conn):
if_alias_map = dict()

for if_name in oid_name_map.values():
if_entry = db_conn.get_all(CONFIG_DB, mgmt_if_entry_table(if_name), blocking=True)
if_entry = db_conn.get_all(CONFIG_DB, mgmt_if_entry_table(if_name), blocking=False)
if_alias_map[if_name] = if_entry.get('alias', if_name)

logger.debug("Management alias map:\n" + pprint.pformat(if_alias_map, indent=2))
Expand Down Expand Up @@ -319,7 +319,7 @@ def init_sync_d_interface_tables(db_conn):
if_alias_map = dict()

for if_name in if_name_map:
if_entry = db_conn.get_all(APPL_DB, if_entry_table(if_name), blocking=True)
if_entry = db_conn.get_all(APPL_DB, if_entry_table(if_name), blocking=False)
if_alias_map[if_name] = if_entry.get('alias', if_name)

logger.debug("Chassis name map:\n" + pprint.pformat(if_alias_map, indent=2))
Expand Down
2 changes: 1 addition & 1 deletion src/sonic_ax_impl/mibs/ieee802_1ab.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def _get_if_entry(self, if_name):
else:
return None

return Namespace.dbs_get_all(self.db_conn, db, if_table, blocking=True)
return Namespace.dbs_get_all(self.db_conn, db, if_table, blocking=False)

def update_interface_data(self, if_name):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/sonic_ax_impl/mibs/ietf/rfc1213.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def _get_if_entry(self, sub_id):
else:
return None

return Namespace.dbs_get_all(self.db_conn, db, if_table, blocking=True)
return Namespace.dbs_get_all(self.db_conn, db, if_table, blocking=False)

def _get_if_entry_state_db(self, sub_id):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/sonic_ax_impl/mibs/ietf/rfc2863.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def _get_if_entry(self, oid):
else:
return None

return Namespace.dbs_get_all(self.db_conn, db, if_table, blocking=True)
return Namespace.dbs_get_all(self.db_conn, db, if_table, blocking=False)

def get_high_speed(self, sub_id):
"""
Expand Down

0 comments on commit 5c955f0

Please sign in to comment.