Skip to content

adding graceful stop signaling for NRI launched plugins - #342

Open
mikebrow wants to merge 1 commit into
containerd:mainfrom
mikebrow:address-graceful-shutdown-todo
Open

mikebrow wants to merge 1 commit into
containerd:mainfrom
mikebrow:address-graceful-shutdown-todo

Conversation

@mikebrow

Copy link
Copy Markdown
Member

This feature adds support for graceful shutdown of NRI launched plugins, removing an old TODO to send a stop signal in this case waiting for a timeout then sending the kill.

Also adds some doc explaining how plugins are typically launched and configured then later how this feature is used.

some drafting assistance from IBM Bob

@mikebrow mikebrow added documentation Improvements or additions to documentation enhancement New feature or request area/nri Node Resource Interface (NRI) labels Oct 28, 2026
@mikebrow
mikebrow requested review from klihub and a lite review from Copilot October 28, 2026 23:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Several moderate issues remain, including sequential cleanup that can multiply shutdown delays, a registration-failure path that can leak launched plugins, and tests excluded from normal runs.

3 open issues
1 file not reviewed
  • pkg/api/api_vtproto.pb.go: Generated file
What changed in this PR

Adds graceful shutdown support for NRI-launched plugins, allowing configured stop signals and a grace period before forceful termination.

Changes:

  • Adds configurable stop-signal support through the API and WithStopSignal.
  • Adds a default five-second stop timeout with signal, wait, and kill lifecycle handling.
  • Applies parallel plugin shutdown and documents launch, configuration, and graceful-stop behavior.
  • Adds Unix-specific tests for graceful stopping, timeout kills, parallel shutdown, and configuration validation.

This pull request requires changes.

File Changes and review findings
README.md Documents plugin launch, configuration, and graceful shutdown. Moderate (1 vote): failed startup cleanup can leave a connected process running. Nit (1 vote): clarify that killing applies to runtime-launched plugins, while external plugins are disconnected.
pkg/​stub/​stub.go Adds WithStopSignal and includes the selected signal in configuration responses. Moderate (1 vote): reject uncatchable signals such as SIGKILL and SIGSTOP, and validate protocol responses consistently.
pkg/​api/​timeouts.go Defines the default plugin stop timeout.
pkg/​api/​api.proto Adds the stop_signal configuration field.
pkg/​api/​api_vtproto.pb.go Adds serialization and deserialization support for stop_signal.
pkg/​adaptation/​plugin.go Implements signal-based stopping, timeout handling, and process reaping. Moderate (3 votes): kill launched plugins when registration fails via connection closure. Moderate (1 vote): validate stop signals and reject uncatchable or invalid values.
pkg/​adaptation/​plugin_stop_test.go Adds tests for graceful signals, timeout kills, parallel stopping, and configuration validation. Moderate (3 votes): replace the unsupported unix build tag with supported GOOS constraints so tests run normally.
pkg/​adaptation/​adaptation.go Adds concurrent plugin shutdown and startup cleanup. Moderate (2 votes): use the parallel helper when removing closed plugins to avoid cumulative stop timeouts.

Review effort: Lite

Comment thread pkg/adaptation/adaptation.go Resolved
Comment thread pkg/adaptation/plugin.go Resolved
Comment thread pkg/adaptation/plugin_stop_test.go Resolved
@mikebrow
mikebrow force-pushed the address-graceful-shutdown-todo branch from 341a9bc to 27baaba Compare October 29, 2026 00:46

@klihub klihub left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me.

Signed-off-by: Mike Brown <brownwm@us.ibm.com>
@mikebrow
mikebrow force-pushed the address-graceful-shutdown-todo branch from 8830da8 to 1a545b1 Compare November 19, 2026 19:45
@mikebrow

Copy link
Copy Markdown
Member Author

had to rebase, fix conflicts, and fix a new modernize lint check.. for for range loops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/nri Node Resource Interface (NRI) documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants