Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Proposal: handle SIGTERM by default to initiate graceful worker shutdown

オープン
#3,135 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@eamsden がすでに取り組んでいます。

2026年10月8日 から。

評価

この issue はまだ評価されていません。

説明

Summary

A Temporal Java worker installs no graceful-shutdown signal handling by default. The JVM runs shutdown hooks on SIGTERM, but the SDK registers none that drain the worker, so a bare worker exits without stopping polling or draining in-flight work. In-flight activities are abandoned and retried server-side after their timeouts.

Proposal: consider a built-in option to initiate WorkerFactory shutdown on SIGTERM by default (opt-out-able), so the common containerized case — stop polling → drain → cancel — works without extra wiring.

Current workaround

A JVM shutdown hook calling WorkerFactory.shutdown() → awaitTermination(timeout) → shutdownNow() (plus WorkerOptions.setAllowActivityHeartbeatDuringShutdown(true) to let a heartbeating activity finish during the drain); or run under the Spring Boot starter, which wires it.

Precedent

The TypeScript SDK already does this: its Runtime installs handlers for SIGINT/SIGTERM/SIGQUIT/SIGUSR2 by default and calls shutdown() on every worker.

Trade-offs / open questions (why it is not already the default)

  • A worker usually runs inside a larger process (HTTP server, DI host, other lifecycle). A library installing a process-global signal handler can conflict with the host application's own signal handling, so any default must be clearly opt-out-able and should no-op when a host framework already owns the signal.
  • Default-on vs. an explicit opt-in flag?
  • If added, match the TypeScript semantics and honor the existing grace/drain config.

Why this comes up

SIGTERM-before-SIGKILL is the standard stop protocol for Kubernetes, Cloud Run, ECS, docker stop, and systemd. Users commonly expect a worker to drain on SIGTERM without extra wiring, and it is a recurring support question (e.g. https://community.temporal.io/t/proper-way-to-shutdown-on-sigterm-sigint/5485).

Related: #2026.

One of a set of sibling issues on default SIGTERM handling across the SDKs that do not auto-handle it today (Go, Python, Java, .NET, Ruby, Rust). TypeScript already does; PHP delegates process lifecycle to RoadRunner.

主要言語
Java
スター
434
フォーク
260
平均マージ
2日 18時間
マージ済み PR(30日)
24

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

temporalio/sdk-java のほかの issue

temporalio/sdk-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。