Skip to content

Commit

Permalink
[xcvrd] Force cleanup of chassis global variable on deinit (#193)
Browse files Browse the repository at this point in the history
- Description
I added a del directive for the global platform_chassis object in xcvrd on deinit to ensure that the pointer is properly cleaned up such that the __del__() method is successfully called on the chassis object which closes its connection to SAI.

- Motivation and Context
On Mellanox platforms on 202012 we are seeing that in some cases xcvrd is maintaining the socket to the API past its deconstruction causing an error from SAI. This was traced by reproducing the issue and identifying that the pmon container was causing this issue where xcvrd is the only daemon within pmon that opens a SDK socket on Mellanox.

Error in log...

syncd#SDK: [SX_API_INTERNAL.ERR] Failed command read at communication channel: Connection reset by peer

- How Has This Been Tested?
Change was uploaded to xcvrd on running pmon container on a switch running the latest 202012 build. xcvrd was then restarted with supervisord and we verified that we could no longer reproduce the bug.
  • Loading branch information
alexrallen authored Jun 16, 2021
1 parent a6903c0 commit eb8a223
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,8 @@ def deinit(self):
if self.y_cable_presence[0] is True:
y_cable_helper.delete_ports_status_for_y_cable()

del globals()['platform_chassis']

# Run daemon

def run(self):
Expand Down

0 comments on commit eb8a223

Please sign in to comment.