Proposal: handle SIGTERM by default to initiate graceful worker shutdown
Les mainteneurs répondent en général sous 1 jour
@eamsden y travaille déjà.
Depuis le 8/10/2026.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
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.
- Langage dominant
- Java
- Étoiles
- 441
- Forks
- 260
- Merge moyen
- 4 j 7 h
- PR mergées (30 j)
- 21
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de temporalio/sdk-java
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
temporalio/sdk-java#1825 ·
Les mainteneurs répondent en général sous 1 jour
-
Skipped mutableSideEffect leaks an empty RecordMarker command after a full replay, and the workflow task fails on every retryPeut-être pris @Quinn-With-Two-Ns l’a pris il y a 4 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
temporalio/sdk-java#3163 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Add Spring Boot auto-configuration for standalone ActivityClientPeut-être pris @Quinn-With-Two-Ns l’a pris il y a 4 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
temporalio/sdk-java#3146 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Skip result deserialization for local activities and SideEffect when not replaying (mutableSideEffect already does this)Peut-être pris @Quinn-With-Two-Ns l’a pris il y a 14 jours. Ouverteenhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 54/100
temporalio/sdk-java#3125 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Skip input serialization for local activities when doNotIncludeArgumentsIntoMarker is setPeut-être pris @Quinn-With-Two-Ns l’a pris il y a 14 jours. Ouverteenhancement
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
temporalio/sdk-java#3124 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de temporalio/sdk-java
Issues similaires
-
:Search Relevance/Vectors >test-failure needs:risk Team:Search Relevance
Difficulté 2/5 1-3 heures Accessibilité débutants 61/100
elastic/elasticsearch#163668 · 3 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
agent:working bug follow-up lane:auto
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Sanne/incus-spawn#1765 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Mend: dependency security vulnerability untriaged
Difficulté 2/5 1-3 heures Accessibilité débutants 63/100
opensearch-project/data-prepper#7219 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
Les mainteneurs répondent en général sous 1 jour