Proposal: handle SIGTERM by default to initiate graceful worker shutdown
Mantenedores costumam responder em até 2 dias
@eamsden já está trabalhando nisso.
Desde 8/10/2026.
Avaliação
Esta issue ainda não foi avaliada.
Descrição
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.
- Linguagem predominante
- Java
- Estrelas
- 441
- Forks
- 266
- Merge médio
- 5d 3h
- PRs com merge (30d)
- 19
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de temporalio/sdk-java
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
temporalio/sdk-java#1825 ·
Mantenedores costumam responder em até 2 dias
-
Skipped mutableSideEffect leaks an empty RecordMarker command after a full replay, and the workflow task fails on every retryTalvez já em andamento @Quinn-With-Two-Ns assumiu há 10 dias. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 52/100
temporalio/sdk-java#3163 · 3 comentários · 1 responsável ·
Mantenedores costumam responder em até 2 dias
-
Add Spring Boot auto-configuration for standalone ActivityClientTalvez já em andamento @Quinn-With-Two-Ns assumiu há 10 dias. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
temporalio/sdk-java#3146 · 2 comentários · 1 responsável ·
Mantenedores costumam responder em até 2 dias
-
Skip result deserialization for local activities and SideEffect when not replaying (mutableSideEffect already does this)Talvez já em andamento @Quinn-With-Two-Ns assumiu há 20 dias. Abertaenhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 54/100
temporalio/sdk-java#3125 · 2 comentários · 1 responsável ·
Mantenedores costumam responder em até 2 dias
-
Skip input serialization for local activities when doNotIncludeArgumentsIntoMarker is setTalvez já em andamento @Quinn-With-Two-Ns assumiu há 20 dias. Abertaenhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
temporalio/sdk-java#3124 · 1 responsável ·
Mantenedores costumam responder em até 2 dias
Todas as issues de temporalio/sdk-java
Issues semelhantes
-
5.0.x backport enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 63/100
spring-cloud/spring-cloud-function#1507 ·
Mantenedores costumam responder em até 1 dia
-
ai-driven-fuzzing bug claude Minor
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
linagora/twake-calendar-side-service#1417 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
line/armeria#7109 · 3 reações ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
a2aproject/a2a-java#1275 ·
Mantenedores costumam responder em até 1 dia
-
module/ftp Type/Bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
ballerina-platform/ballerina-library#9476 ·
Mantenedores costumam responder em até 1 dia