[LIVY-1081] SparkKubernetesApp: latch first observed app ID, reject mismatched re-attach under same tag - #556
Open
soumyadeeplogin wants to merge 1 commit into
Conversation
…re-attach monitorSparkKubernetesApp() re-resolves the tracked Kubernetes application on every poll cycle via a tag substring match, with no check that the resolved app ID matches what was seen on a previous poll. A stale/leaked tag or a tag substring collision could silently switch which application is tracked. Latch the first observed app ID per session and reject any later poll that observes a different app ID for the same tag, failing the promise and draining the session to FAILED rather than silently continuing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Author
|
Filed LIVY-1081 for this change. |
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 changes were proposed in this pull request?
SparkKubernetesApp.monitorSparkKubernetesApp()re-resolves the tracked Kubernetesapplication on every poll cycle via a tag substring match
(
getApplicationTag.contains(appTag)), and previously used whatever app ID it foundwith no check against what it had seen before. If a stale/leaked tag reappeared or a
tag-substring collision occurred, a later poll could silently start tracking a
different application under the same tag, with no error.
This adds a
knownAppIdlatch: the first observed app ID for a session is remembered,and any later poll that resolves a different app ID for the same tag is rejected —
the promise fails, the session is driven to
FAILED, and the tag is marked leaked,mirroring the treatment of other terminal monitoring failures.
The decision logic is extracted into a pure, testable function,
SparkKubernetesApp.latchAppId(), following the pattern used in #544.How was this patch tested?
Added
latchAppIdunit tests toSparkKubernetesAppSpeccovering: no app ID knownyet (latches), matching app ID re-observed (no-op), and mismatched app ID observed
under the same tag (rejected with a diagnostic message naming the tag and both IDs).
Ran
mvn -pl server -am test -Dtest=SparkKubernetesAppSpec: 14/14 tests pass (3 new).Was this patch authored or co-authored using generative AI tooling?
Yes. This patch was authored with the assistance of Claude (Anthropic), used to
implement the
latchAppIdextraction and its unit tests, following the ASF'sGenerative Tooling Guidance (https://www.apache.org/legal/generative-tooling.html).
All code was reviewed by the human contributor before submission.