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

[sonic-py-common.task_base] Provide ability to set stop timeouts #6914

Merged
merged 2 commits into from
Apr 8, 2021
Merged

[sonic-py-common.task_base] Provide ability to set stop timeouts #6914

merged 2 commits into from
Apr 8, 2021

Conversation

jleveque
Copy link
Contributor

Why I did it

Allowing an application to set a stop timeout for processes and threads provides the following benefits:

  1. Prevents the application from hanging indefinitely in the case a process or thread does not exit
  2. Allow ProcessTaskBase a chance to let the process exit gracefully before attempting to kill it

Default values are as follows:

  • ProcessTaskBase: 1 second
  • ThreadTaskBase: No timeout

How I did it

  • Add optional stop_timeout_secs parameter to initializers of ProcessTaskBase and ThreadTaskBase
  • Additionally:
    • Prefix private attributes with an underscore
    • Remove obsolete comments

How to verify it

Create concrete implementations of the classes and test the timeout functionality.

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

  • 201811
  • 201911
  • 202006
  • 202012

@jleveque jleveque merged commit 39a5efe into sonic-net:master Apr 8, 2021
@jleveque jleveque deleted the graceful_task_exit branch April 8, 2021 17:23
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-buildimage that referenced this pull request May 23, 2021
…ic-net#6914)

#### Why I did it

Allowing an application to set a stop timeout for processes and threads provides the following benefits:

1. Prevents the application from hanging indefinitely in the case a process or thread does not exit
2. Allow ProcessTaskBase a chance to let the process exit gracefully before attempting to kill it

Default values are as follows:
- ProcessTaskBase: 1 second
- ThreadTaskBase: No timeout

#### How I did it

- Add optional `stop_timeout_secs` parameter to initializers of ProcessTaskBase and ThreadTaskBase
- Additionally:
    - Prefix private attributes with an underscore
    - Remove obsolete comments
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
…ic-net#6914)

#### Why I did it

Allowing an application to set a stop timeout for processes and threads provides the following benefits:

1. Prevents the application from hanging indefinitely in the case a process or thread does not exit
2. Allow ProcessTaskBase a chance to let the process exit gracefully before attempting to kill it

Default values are as follows:
- ProcessTaskBase: 1 second
- ThreadTaskBase: No timeout

#### How I did it

- Add optional `stop_timeout_secs` parameter to initializers of ProcessTaskBase and ThreadTaskBase
- Additionally:
    - Prefix private attributes with an underscore
    - Remove obsolete comments
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.

2 participants