Skip to content

Commit

Permalink
[vrf]: Fix freezing during interface binding (sonic-net#1325)
Browse files Browse the repository at this point in the history
* Replacing using 'get_all' with 'exists' in port state checking procedure inside bind function to avoid freezing in the while loop, what caused by absence of related record in STATE_DB.

Signed-off-by: Maksym Belei <Maksym_Belei@jabil.com>
  • Loading branch information
maksymbelei95 authored Feb 2, 2021
1 parent 2e1f354 commit a6ae218
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3079,7 +3079,7 @@ def bind(ctx, interface_name, vrf_name):
state_db = SonicV2Connector(use_unix_socket_path=True, namespace=ctx.obj['namespace'])
state_db.connect(state_db.STATE_DB, False)
_hash = '{}{}'.format('INTERFACE_TABLE|', interface_name)
while state_db.get_all(state_db.STATE_DB, _hash) != None:
while state_db.exists(state_db.STATE_DB, _hash):
time.sleep(0.01)
state_db.close(state_db.STATE_DB)
config_db.set_entry(table_name, interface_name, {"vrf_name": vrf_name})
Expand Down

0 comments on commit a6ae218

Please sign in to comment.