You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@livy.apache.org by "Nilesh Rathi (Jira)" <ji...@apache.org> on 2026/08/04 10:05:00 UTC
[jira] [Commented] (LIVY-1063) Fix resource leak in Kubernetes service account token refresh
[ https://issues.apache.org/jira/browse/LIVY-1063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18101663#comment-18101663 ]
Nilesh Rathi commented on LIVY-1063:
------------------------------------
Observed in a long-running Livy deployment on Kubernetes: native thread count grew ~every 5 minutes while RefreshServiceAccountTokenThread was active. After reusing the existing client (only updating the OAuth token), thread count stayed flat over a multi-hour soak.
Token refresh logs continued every ~5 minutes.
> Fix resource leak in Kubernetes service account token refresh
> -------------------------------------------------------------
>
> Key: LIVY-1063
> URL: https://issues.apache.org/jira/browse/LIVY-1063
> Project: Livy
> Issue Type: Bug
> Reporter: Nilesh Rathi
> Assignee: Nilesh Rathi
> Priority: Major
> Labels: kubernetes
> Time Spent: 10m
> Remaining Estimate: 0h
>
> RefreshServiceAccountTokenThread in SparkKubernetesApp recreates DefaultKubernetesClient every 5 minutes during service account token refresh. The previous client is never closed, causing a slow resource leak (native threads / HTTP client pools) in long-running Livy deployments on Kubernetes.
> The client is documented as thread-safe and intended to be created once at init(). The refresh loop should only update the OAuth token on the existing client via config.setOauthToken(), not instantiate a new DefaultKubernetesClient.
> Affected code: server/src/main/scala/org/apache/livy/utils/SparkKubernetesApp.scala (introduced in LIVY-702).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)