Skip to content

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

Merged
jleveque merged 2 commits intosonic-net:masterfrom
jleveque:graceful_task_exit
Apr 8, 2021
Merged

[sonic-py-common.task_base] Provide ability to set stop timeouts#6914
jleveque merged 2 commits intosonic-net:masterfrom
jleveque:graceful_task_exit

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