[FLINK-39984][runtime][webUI] Support LITE/FULL thread dump modes#28732
Open
xingsuo-zbz wants to merge 1 commit into
Open
[FLINK-39984][runtime][webUI] Support LITE/FULL thread dump modes#28732xingsuo-zbz wants to merge 1 commit into
xingsuo-zbz wants to merge 1 commit into
Conversation
Collaborator
Contributor
|
A few minor comments before the review:
|
xingsuo-zbz
force-pushed
the
zbz/thread-dump-safe-mode
branch
3 times, most recently
from
July 15, 2026 12:26
bc6b4a8 to
36f9795
Compare
Contributor
Author
|
@flinkbot run azure |
Contributor
Author
|
@spuru9 done,please continue to review |
Myasuka
requested changes
Jul 20, 2026
Myasuka
left a comment
Member
There was a problem hiding this comment.
I think we should split this PR into two PRs, one is to use ioExecutor instead of main thread; one is to introduce new feature that we can have options to select when creating thread dumps.
xingsuo-zbz
force-pushed
the
zbz/thread-dump-safe-mode
branch
from
July 20, 2026 11:05
36f9795 to
117a668
Compare
ThreadMXBean.dumpAllThreads(true, true) enters a single JVM-wide
safepoint to collect monitor/synchronizer state; on busy JVMs the pause
can exceed heartbeat.timeout and cause unnecessary TaskManager failover.
- Introduce ThreadDumpMode {LITE, FULL}: LITE = dumpAllThreads(false,
false), FULL preserves today's (true, true) behavior. Exposed via an
optional query parameter `?mode=lite|full` on the JM/TM thread-dump
endpoints.
- Add config cluster.thread-dump.default-mode (default FULL to preserve
upgrade behavior; LITE recommended for large clusters).
- Add a Lite/Full toggle to both Web UI thread-dump pages; selecting a
mode does not auto-fetch, the download link tracks the selection.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
xingsuo-zbz
force-pushed
the
zbz/thread-dump-safe-mode
branch
from
July 20, 2026 13:09
117a668 to
86388ac
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Fixes FLINK-39984. Clicking "Thread Dump" on a JobManager or TaskManager in the Web UI can cause the targeted process to miss heartbeats and be marked dead by the JobManager, taking down otherwise healthy running jobs.
The dominant cost is not the RPC dispatch but the underlying JVM safepoint:
JvmUtils#createThreadDumpunconditionally callsThreadMXBean.dumpAllThreads(true, true), which requires walking every thread's locked-monitor and j.u.c. synchronizer state inside a single JVM-wide safepoint. On JVMs with many threads (Netty + RocksDB + async I/O + user threads — 10k+ in production is not uncommon) this pauses the entire JVM (including the heartbeat dispatcher) for seconds to tens of seconds. If the pause exceedsheartbeat.timeout(default 50 s), the JM triggers an unnecessary TaskManager failover on what was intended as a purely diagnostic action.This PR makes the dump granularity configurable so operators can pick a mode whose safepoint pause is bounded well
below heartbeat.timeout. A companion PR under the same JIRA additionally offloads the dump construction to
ioExecutor so the RPC mailbox no longer stalls behind the dump; the two fixes are complementary but independent.
Brief change log
ResourceManagerGateway / TaskExecutorGatewayDecoratorBase / NonLeaderRetrievalRestfulGateway.
/jobmanager/thread-dumpand/taskmanagers/{id}/thread-dumpvia a new ThreadDumpModeQueryParameter and two new MessageParameters classes; unknown values become HTTP 400.cluster.thread-dump.default-mode (default FULL)that controls the fallback when no query parameter is supplied. Default is deliberately FULL to preserve the existing on-upgrade behavior; the description flags LITE as the recommended value for large clusters. A separate dev@ discussion will decide whether to flip the default in a future release.(flink-runtime-web/web-dashboard/.../{job,task}-manager/thread-dump/). Selecting a mode does not auto-fetch; the user must press the refresh button (avoids surprising the operator when they merely click the toggle). The download link tracks the current selection so exported dumps match the on-screen content.
Verifying this change
This change added tests and can be verified as follows:
New unit tests
unknown value → IllegalArgumentException, and lower-case serialization.
non-empty dump for null, LITE, and FULL, and (b) when mode is omitted the request honors
cluster.thread-dump.default-mode (the test overrides it to LITE and asserts the "Number of locked synchronizers"
section is absent, which only appears in FULL).
Existing tests updated
ThreadDumpMode parameter.
against the updated snapshot.
Does this pull request potentially affect one of the following parts:
@Public(Evolving): norequest no longer blocks the RPC mailbox and when the operator selects LITE, the
safepoint pause is short enough not to trip heartbeat.timeout.)
Documentation
cluster.thread-dump.default-modeconfig option.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Claude Opus 4.7)