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

[SSD]Enhance ssd_generic with more error handling to avoid python crash #271

Merged
merged 1 commit into from
Apr 4, 2022

Conversation

keboliu
Copy link
Collaborator

@keboliu keboliu commented Apr 1, 2022

Signed-off-by: Kebo Liu kebol@nvidia.com

Description

  1. Judge the self._parse_re return value, if it's N/A then stop further string slice handling to avoid a crash.

  2. Update the regular expression pattern for Innodisk SSD health, to handle the case that the output of the health section is different when its lifetime reaches the end.

Motivation and Context

  1. Original code doesn't handle the case that self._parse_re returns N/A, it's assuming that self._parse_re will always return a none N/A value thus further handling the result w/o judge, which could in a crash.

  2. On Innodisk SSD, when the SSD remaining lifetime reaches the end, the output of the Health section will be a number w/o %, e.g. Health: 0.00 instead of Health: 95.0% in the normal case, need to update the regular expression to handle this case.

How Has This Been Tested?

  1. UT test has been added.
  2. Tested the change on platforms with different types of SSD.

Additional Information (Optional)

@keboliu keboliu changed the title enhance ssd_generic with more error handling to avoid python crash [SSD]Enhance ssd_generic with more error handling to avoid python crash Apr 1, 2022
Copy link
Collaborator

@stephenxs stephenxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sujinmkang sujinmkang merged commit 01512ec into sonic-net:master Apr 4, 2022
@keboliu keboliu deleted the ssd-generic-fix branch April 7, 2022 05:48
liat-grozovik pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Apr 7, 2022
Update sonic-platform-common submodule to pickup new commits:
01512ec [SSD]Enhance ssd_generic with more error handling to avoid python crash sonic-net/sonic-platform-common#271
ac3e7f1 [y_cable][Broadcom] update the BRCM y_cable driver to release 2.0 sonic-net/sonic-platform-common#263
573717a [Credo][Ycable] Fix Credo firmware download API download_firmware flag sonic-net/sonic-platform-common#269
a844f18 [xcvr] Add get_module_fw_info method to XcvrApi class. sonic-net/sonic-platform-common#267
35bad16 [sfputil]Refactoring read_porttab_mappings sonic-net/sonic-platform-common#264
83c4345 [SSD Generic] Add support for parsing nvme ssd model, health and temperature sonic-net/sonic-platform-common#265
5da31e1 [ycable][credo] Fix the is_link_active API for Credo Ycable sonic-net/sonic-platform-common#260
931c6ea [Y-Cable][Credo] add theading locker to support thread-safe calling, add SKU check for download_firmware API. sonic-net/sonic-platform-common#222
ff3aa75 Fix SFF8472 Enhanced Options sonic-net/sonic-platform-common#259
a8a83e9 [ssd] Allow individual vendor parsers to handle errors sonic-net/sonic-platform-common#252

Signed-off-by: Kebo Liu <kebol@nvidia.com>
sujinmkang pushed a commit that referenced this pull request Apr 7, 2022
…id python crash #273

Signed-off-by: Kebo Liu kebol@nvidia.com

Description
Backport #271 to 202012

Judge the self._parse_re return value, if it's N/A then stop further string slice handling to avoid a crash.

Update the regular expression pattern for Innodisk SSD health, to handle the case that the output of the health section is different when its lifetime reaches the end.

Motivation and Context
Original code doesn't handle the case that self._parse_re returns N/A, it's assuming that self._parse_re will always return a none N/A value thus further handling the result w/o judge, which could in a crash.

On Innodisk SSD, when the SSD remaining lifetime reaches the end, the output of the Health section will be a number w/o %, e.g. Health: 0.00 instead of Health: 95.0% in the normal case, need to update the regular expression to handle this case.

How Has This Been Tested?
UT test has been added.
Tested the change on platforms with different types of SSD.
judyjoseph pushed a commit that referenced this pull request Apr 11, 2022
#271

Signed-off-by: Kebo Liu kebol@nvidia.com

Description
Judge the self._parse_re return value, if it's N/A then stop further string slice handling to avoid a crash.

Update the regular expression pattern for Innodisk SSD health, to handle the case that the output of the health section is different when its lifetime reaches the end.

Motivation and Context
Original code doesn't handle the case that self._parse_re returns N/A, it's assuming that self._parse_re will always return a none N/A value thus further handling the result w/o judge, which could in a crash.

On Innodisk SSD, when the SSD remaining lifetime reaches the end, the output of the Health section will be a number w/o %, e.g. Health: 0.00 instead of Health: 95.0% in the normal case, need to update the regular expression to handle this case.

How Has This Been Tested?
UT test has been added.
Tested the change on platforms with different types of SSD.
itamar-talmon pushed a commit to itamar-talmon/sonic-platform-common that referenced this pull request Jan 12, 2023
sonic-net#271

Signed-off-by: Kebo Liu kebol@nvidia.com

Description
Judge the self._parse_re return value, if it's N/A then stop further string slice handling to avoid a crash.

Update the regular expression pattern for Innodisk SSD health, to handle the case that the output of the health section is different when its lifetime reaches the end.

Motivation and Context
Original code doesn't handle the case that self._parse_re returns N/A, it's assuming that self._parse_re will always return a none N/A value thus further handling the result w/o judge, which could in a crash.

On Innodisk SSD, when the SSD remaining lifetime reaches the end, the output of the Health section will be a number w/o %, e.g. Health: 0.00 instead of Health: 95.0% in the normal case, need to update the regular expression to handle this case.

How Has This Been Tested?
UT test has been added.
Tested the change on platforms with different types of SSD.
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-platform-common that referenced this pull request Oct 25, 2024
… work (sonic-net#271)

This PR is meant to fix gRPC keepalive timeout values. With this change and adding the options to server side, the pings start working for TCP connection for all gRPC channels. This PR is also meant to increase the time intervals between pings to 4 seconds for gRPC connections
With this change the TCP connections are always persistent
example:

admin@sonic:~$ netstat | grep 50075
tcp6       0      0 tmg.dtap.sphybrid:41828 vlan2003.mim-a75s:50075 ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:43912 192.168.0.3:50075       ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:43620 win-cfr7mesbc6v.c:50075 ESTABLISHED
tcp6       0      0 192.168.0.1:37768       192.168.0.23:50075      ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:58776 win-cfr7mesbc6v.c:50075 ESTABLISHED
tcp6       0      0 192.168.0.1:34634       192.168.0.21:50075      ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:47672 win-cfr7mesbc6v.c:50075 ESTABLISHED
tcp6       0      0 192.168.0.1:42318       192.168.0.7:50075       ESTABLISHED
tcp6       0      0 192.168.0.1:48792       co1speutlv104.phx:50075 ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:34794 dtap15.dtap.sphyb:50075 ESTABLISHED
tcp6       0      0 192.168.0.1:56194       192.168.0.13:50075      ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:43548 win-cfr7mesbc6v.c:50075 ESTABLISHED


Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants