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

Fix crash when retrieving cpu utilization #70

Merged
merged 25 commits into from
Jan 31, 2023

Conversation

zbud-msft
Copy link
Contributor

@zbud-msft zbud-msft commented Jan 20, 2023

Why I did it

Fix crash in which there was a divide by zero error inside retrieving cpu utilization

Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry #011/sonic/src/sonic-telemetry/sonic_data_client/non_db_client.go:139 +0x99
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry github.com/Azure/sonic-telemetry/sonic_data_client.getCpuUtil
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry #011/sonic/src/sonic-telemetry/sonic_data_client/non_db_client.go:221 +0x34
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry (0xc000000006, 0xc002e0ae00, 0x1, 0x1, 0x0)
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry github.com/Azure/sonic-telemetry/sonic_data_client.getCpuUtilStat(0x0)
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry goroutine 742 [running]:
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry #011/sonic/src/sonic-telemetry/sonic_data_client/non_db_client.go:162 +0x2e6
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry github.com/Azure/sonic-telemetry/sonic_data_client.(*NonDbClient).PollRun(0xc001bc42a0, 0xc00027eaf0, 0xc001bc83c0, 0xc001be8868, 0xc001be8880)
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry #011/sonic/src/sonic-telemetry/sonic_data_client/non_db_client.go:538 +0xd4
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry #011/sonic/src/sonic-telemetry/gnmi_server/client_subscribe.go:146 +0x765
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry github.com/Azure/sonic-telemetry/sonic_data_client.runGetterAndSend(0xc001bc42a0, 0xc001be8a00, 0x101cc08, 0x0, 0x0)
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry created by github.com/Azure/sonic-telemetry/gnmi_server.(*Client).Run
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry github.com/Azure/sonic-telemetry/sonic_data_client.getCpuUtilPercents(0xc00239c300, 0xc002e0aa30, 0x2)
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry panic: runtime error: integer divide by zero
Dec 1 04:31:03 PHX70-0101-0719-14T1 telemetry#/supervisord: telemetry #011/sonic/src/sonic-telemetry/sonic_data_client/non_db_client.go:499 +0x3c

How I did it

Add edge case check and UT

How to verify it

Run UT

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

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

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

@zbud-msft zbud-msft marked this pull request as draft January 20, 2023 20:32
gnmi_server/server_test.go Outdated Show resolved Hide resolved
gnmi_server/server_test.go Outdated Show resolved Hide resolved
gnmi_server/server_test.go Outdated Show resolved Hide resolved
gnmi_server/server_test.go Outdated Show resolved Hide resolved
gnmi_server/server_test.go Outdated Show resolved Hide resolved
gnmi_server/server_test.go Outdated Show resolved Hide resolved
gnmi_server/server_test.go Outdated Show resolved Hide resolved
gnmi_server/server_test.go Outdated Show resolved Hide resolved
sonic_data_client/non_db_client.go Outdated Show resolved Hide resolved
@zbud-msft zbud-msft changed the title Cpu util percent Fix crash when retrieving cpu utilization Jan 24, 2023
@zbud-msft zbud-msft marked this pull request as ready for review January 24, 2023 01:03
sonic_data_client/non_db_client.go Outdated Show resolved Hide resolved
gnmi_server/server_test.go Outdated Show resolved Hide resolved
gnmi_server/server_test.go Outdated Show resolved Hide resolved
gnmi_server/server_test.go Outdated Show resolved Hide resolved
gnmi_server/server_test.go Outdated Show resolved Hide resolved
@zbud-msft zbud-msft merged commit a792474 into sonic-net:master Jan 31, 2023
zbud-msft added a commit to zbud-msft/sonic-gnmi that referenced this pull request Jan 31, 2023
Fix crash in which there was a divide by zero error inside retrieving cpu utilization
Copy link
Contributor

@tomek-US tomek-US left a comment

Choose a reason for hiding this comment

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

LGTM

sonic_data_client/non_db_client.go Show resolved Hide resolved
@zbud-msft zbud-msft deleted the cpu_util_percent branch March 1, 2023 18:37
zbud-msft added a commit that referenced this pull request Mar 1, 2023
Fix crash in which there was a divide by zero error inside retrieving cpu utilization
qiluo-msft pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Mar 10, 2023
#### Why I did it

update contains following commits

50123ef Zain Budhwani   Tue Feb 28 16:48:22 2023 -0800  Add logs for md5 checksum (sonic-net/sonic-gnmi#80)
a90f2b3 Zain Budhwani   Mon Feb 27 23:44:49 2023 -0800  Add get-update to azp yml (sonic-net/sonic-gnmi#79)
14fe6f4 Zain Budhwani   Tue Jan 31 14:11:27 2023 -0800  Add 202012 branch to pr checker (sonic-net/sonic-gnmi#72)
a792474 Zain Budhwani   Tue Jan 31 09:22:38 2023 -0800  Fix crash when retrieving cpu utilization (sonic-net/sonic-gnmi#70)

#### How I did it

Fetch new changes
xumia pushed a commit to xumia/sonic-buildimage-1 that referenced this pull request Mar 10, 2023
#### Why I did it

update contains following commits

50123ef Zain Budhwani   Tue Feb 28 16:48:22 2023 -0800  Add logs for md5 checksum (sonic-net/sonic-gnmi#80)
a90f2b3 Zain Budhwani   Mon Feb 27 23:44:49 2023 -0800  Add get-update to azp yml (sonic-net/sonic-gnmi#79)
14fe6f4 Zain Budhwani   Tue Jan 31 14:11:27 2023 -0800  Add 202012 branch to pr checker (sonic-net/sonic-gnmi#72)
a792474 Zain Budhwani   Tue Jan 31 09:22:38 2023 -0800  Fix crash when retrieving cpu utilization (sonic-net/sonic-gnmi#70)

#### How I did it

Fetch new changes
qiluo-msft pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Mar 20, 2023
Has following commits:
```
b93c4ac Zain Budhwani Wed Mar 1 15:45:43 2023 -0800 Fix crash when retrieving cpu utilization (sonic-net/sonic-gnmi#70) (sonic-net/sonic-gnmi#71)
af1ec19 Zain Budhwani Wed Mar 1 15:13:53 2023 -0800 Add diff cov (sonic-net/sonic-gnmi#85)
3f41377 Zain Budhwani Tue Feb 28 16:48:22 2023 -0800 Add logs for md5 checksum (sonic-net/sonic-gnmi#80)
67b7fb2 Zain Budhwani Mon Feb 27 23:44:49 2023 -0800 Add get-update to azp yml (sonic-net/sonic-gnmi#79)
5d6c47f Zain Budhwani Fri Feb 24 13:11:53 2023 -0800 Add net core and code coverage results (sonic-net/sonic-gnmi#77)
984bc6d Zain Budhwani Wed Feb 22 16:03:01 2023 -0800 [202012] Enable unit test (sonic-net/sonic-gnmi#76)
e8e4335 Zain Budhwani Fri Feb 10 16:27:58 2023 -0800 Change dir name in pipeline (sonic-net/sonic-gnmi#75)
a1cc7ab Zain Budhwani Tue Jan 31 14:11:27 2023 -0800 Add 202012 branch to pr checker (sonic-net/sonic-gnmi#72)
eaea6c5 ganglyu Mon Nov 14 10:18:07 2022 +0800 Fix format
```
zbud-msft added a commit to zbud-msft/sonic-gnmi that referenced this pull request Jun 8, 2023
Fix crash in which there was a divide by zero error inside retrieving cpu utilization
zbud-msft added a commit to zbud-msft/sonic-gnmi that referenced this pull request Jun 9, 2023
Fix crash in which there was a divide by zero error inside retrieving cpu utilization
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