Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BFN] Canceling PSU platform API calls on SIGTERM #10720

Merged
merged 2 commits into from
Sep 29, 2022

Conversation

akokhan
Copy link
Contributor

@akokhan akokhan commented May 1, 2022

Signed-off-by: Andriy Kokhan andriyx.kokhan@intel.com
Co-authored-by: Taras Keryk tarasx.keryk@intel.com

Why I did it

Sometime, SIGTERM processing by psud takes more then default 10sec (please see stopwaitsecs in http://supervisord.org/configuration.html).

Due to this, the following two testcases may fail:

test_pmon_psud_stop_and_start_status
test_pmon_psud_term_and_start_status

Also, limited get_bmc_version() execution time to 1 sec.

How I did it

Introduced two levels of SIGTERM handlers:

  1. The PSU class level signal_handler() that executes a default handler (psud SIGTERM handler) and avoids subsequent psu_info_get() executions.
  2. The cancel_on_sigterm() decorator that executes class level signal_handler() and raises an exception to cancel current psu_info_get() execution.

How to verify it

Run SONiC CTs:

test_pmon_psud_stop_and_start_status
test_pmon_psud_term_and_start_status

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

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

@akokhan akokhan requested a review from lguohan as a code owner May 1, 2022 08:51
@akokhan
Copy link
Contributor Author

akokhan commented May 1, 2022

@prgeor , please review. Thank you

@akokhan
Copy link
Contributor Author

akokhan commented May 3, 2022

@lguohan , please approve and merge. Thanks

@akokhan
Copy link
Contributor Author

akokhan commented May 4, 2022

@prgeor , @lguohan , could you please take a look. Thank you!

@akokhan
Copy link
Contributor Author

akokhan commented May 6, 2022

@prgeor , could you please take a look?

@akokhan
Copy link
Contributor Author

akokhan commented May 10, 2022

@prgeor , could you please approve and merge? Thanks

@akokhan
Copy link
Contributor Author

akokhan commented May 11, 2022

@lguohan , please approve and merge. Thanks

@akokhan
Copy link
Contributor Author

akokhan commented May 12, 2022

@qiluo-msft , please approve and merge. Thank you

@akokhan akokhan force-pushed the bfn_psu_sigterm branch 6 times, most recently from 450e074 to 58e88d3 Compare May 17, 2022 07:10
@liushilongbuaa
Copy link
Contributor

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@akokhan akokhan force-pushed the bfn_psu_sigterm branch 5 times, most recently from 34edc30 to ddc9d5a Compare May 19, 2022 15:44
@akokhan akokhan closed this May 22, 2022
@akokhan akokhan reopened this May 22, 2022
@akokhan akokhan force-pushed the bfn_psu_sigterm branch 4 times, most recently from ac11afa to ed12d89 Compare May 25, 2022 19:01
@qiluo-msft qiluo-msft requested a review from liuh-80 May 26, 2022 23:06
@qiluo-msft
Copy link
Collaborator

Sorry for late response, we will soon review it.

Copy link
Contributor

@liuh-80 liuh-80 left a comment

Choose a reason for hiding this comment

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

I checked this PR and it's not conflict with the recent change in libswsscommon.
Because this project is a pure python project and not using pubsub from swsscommon, so the signal handler in this PR will not be blocked by the infinite loop in pubsub.

@akokhan akokhan closed this Aug 8, 2022
@akokhan akokhan reopened this Aug 8, 2022
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 8, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: akokhan / name: Andriy Kokhan (32adf556dcef98a65f2dfbf731813deda105790d)
  • ✅ login: tkerykx / name: Taras Keryk (ed12d89493a3a04ad4ee0b1e3f46725fd223c88a)

Andriy Kokhan and others added 2 commits September 11, 2022 12:26
Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com>
Signed-off-by: Taras Keryk <tarasx.keryk@intel.com>
@akokhan akokhan requested review from liuh-80 and removed request for lguohan September 22, 2022 16:00
@prgeor prgeor merged commit 9bb0a7f into sonic-net:master Sep 29, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants