Skip to content

fix(go): stop replacing host process signal handlers during install#411

Open
WellMafra wants to merge 1 commit into
manusa:mainfrom
WellMafra:fix/signal-handlers
Open

fix(go): stop replacing host process signal handlers during install#411
WellMafra wants to merge 1 commit into
manusa:mainfrom
WellMafra:fix/signal-handlers

Conversation

@WellMafra

@WellMafra WellMafra commented Jul 22, 2026

Copy link
Copy Markdown

What

  • Remove the signal.Notify(SIGINT/SIGTERM/SIGKILL/SIGQUIT) block and its cancellation goroutine from the native install path; RunWithContext now receives a plain context.Background()
  • Add HelmSignalHandlerTest, a black-box test that runs a client-only install in a child JVM, sends it SIGTERM via Process.destroy(), and asserts it exits with code 143 within 15s (disabled on Windows)

Why

  • Fixes Go runtime signal handlers permanently replace the host JVM's SIGINT/SIGTERM handlers after install #409: in a c-shared library the first signal.Notify call makes the in-process Go runtime permanently replace the host process' OS-level SIGINT/SIGTERM handlers. Embedding JVMs then ignore SIGTERM — shutdown hooks never run and Kubernetes pods hang until the kubelet SIGKILLs them after terminationGracePeriodSeconds
  • The cancellation that signal.Notify enabled was never reachable for embedders anyway (no CLI context), and each call also leaked a goroutine blocked on the signal channel; SIGKILL in the list was a no-op since it cannot be caught
  • upgrade.go reaches this same path via Install() when the release doesn't exist, so upgrade --install is covered too

Verified: the new test fails against the previous native library (child JVM ignores SIGTERM and times out) and passes with this change; HelmInstallTest (19 tests) still green; gofmt/go vet clean.

@WellMafra
WellMafra marked this pull request as ready for review July 22, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go runtime signal handlers permanently replace the host JVM's SIGINT/SIGTERM handlers after install

1 participant