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

[Mellanox] Bug fix: exception occurred during chassis object being destroyed #66

Closed
wants to merge 1 commit into from

Conversation

stephenxs
Copy link
Owner

Why I did it

The following error message is observed during chassis object being destroyed

Exception ignored in: <function Chassis.__del__ at 0x7fd22165cd08>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/sonic_platform/chassis.py", line 83, in __del__
ImportError: sys.meta_path is None, Python is likely shutting down

The chassis tries to import deinitialize_sdk_handle during being destroyed for the purpose of releasing the sdk_handle.
However, importing another module during shutting down can cause the error because some of the fundamental infrastructures are no longer available.

This error occurs when a chassis object is created and then destroyed in the Python shell.

Signed-off-by: Stephen Sun [email protected]

How I did it

To fix it, record the deinitialize_sdk_handle in the chassis object when sdk_handle is being initialized and call the deinitialize handler when the chassis object is being destroyed

How to verify it

Manually test.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

The following error message is observed during chassis object being destroyed
```
Exception ignored in: <function Chassis.__del__ at 0x7fd22165cd08>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/sonic_platform/chassis.py", line 83, in __del__
ImportError: sys.meta_path is None, Python is likely shutting down
```

The chassis tries to import deinitialize_sdk_handle during being destroyed
for the purpose of releasing the sdk_handle.
However, to import another module during shutting down can causing error
because some of the fundamental infrastructure is no longer available.

To fix it, record the deinitialize_sdk_handle in chassis object when
sdk_handle is being initialized and call the deinitialize handler when
chassis object is being destroyed

Signed-off-by: Stephen Sun <[email protected]>
@stephenxs stephenxs closed this Apr 29, 2021
@stephenxs stephenxs deleted the fix-chassis-destroy-error branch April 29, 2021 22:11
stephenxs pushed a commit that referenced this pull request May 19, 2022
[sonic-linkmgrd][202012] submodule update
3d13ff2 Jing Zhang      Wed May 4 10:07:14 2022 -0700   Add doc for default route related changes  (#63)
c703be4 Jing Zhang      Mon May 2 13:27:54 2022 -0700   Reset WaitActiveUp count before switching to active (#70)
86eb727 Jing Zhang      Wed Apr 27 10:35:05 2022 -0700  lower log level to warning (#69)
e22c736 Jing Zhang      Mon May 2 13:33:24 2022 -0700   [202012] Avoid proactively switching to active if default route is missing (#67)
d4f282b Jing Zhang      Thu Apr 28 18:35:11 2022 -0700  [202012] Add support to enable switchover time measurement (with link prober interval decreased to 10ms) feature (#66)

sign-off: Jing Zhang [[email protected]](mailto:[email protected])
stephenxs pushed a commit that referenced this pull request May 24, 2024
…ically (sonic-net#19036)

#### Why I did it
src/sonic-dbsyncd
```
* d5fa793 - (HEAD -> master, origin/master, origin/HEAD) Handle exception to avoid lldp_syncd crash (#65) (2 hours ago) [Zhaohui Sun]
* bc63571 - Fix pipeline issue. (#66) (25 hours ago) [Liu Shilong]
```
#### How I did it
#### How to verify it
#### Description for the changelog
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

Successfully merging this pull request may close these issues.

2 participants