Skip to content

tentacle: mgr/rook: don't leak a watcher thread per orchestrator call - #71754

Merged
batrick merged 1 commit into
ceph:tentaclefrom
tchaikov:wip-79959-tentacle
Sep 30, 2026
Merged

batrick merged 1 commit into
ceph:tentaclefrom
tchaikov:wip-79959-tentacle

Conversation

@tchaikov

Copy link
Copy Markdown
Contributor

KubernetesResource spawns a watch thread on the first access to
.items, and the thread runs until the watch stream ends. get_osds(),
get_resource() and the device fetchers create a KubernetesResource
per call, so one describe_service() leaks up to five threads, their
HTTPS connections to the apiserver, and the item dicts the threads
keep updating. Poll the orchestrator every few seconds and the active
mgr accumulates threads until it is OOM-killed.

Filter the long-lived rook_pods watch in get_osds() the way
describe_pods() does. Convert the other per-call sites to
fetch_k8s_items(), a one-shot list call that spawns no watcher.
KubernetesResource stays watch-only, for the three long-lived caches
in RookCluster.

Fixes: https://tracker.ceph.com/issues/78589
Signed-off-by: Kefu Chai <[email protected]>
(cherry picked from commit 0c468fe)
@tchaikov
tchaikov requested a review from a team as a code owner September 13, 2026 01:55
@tchaikov tchaikov added this to the tentacle milestone Sep 13, 2026
@tchaikov tchaikov added the core label Sep 13, 2026
@github-actions github-actions Bot added orchestrator pybind rook releng-audit-pass Release engineering: passed backport verification audit. labels Sep 13, 2026
@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath19-testing-20260922.090258-tentacle.

@NitzanMordhai

Copy link
Copy Markdown
Contributor

patsoffice added a commit to patsoffice/home-ops that referenced this pull request Sep 30, 2026
Two unrelated leaks were OOMKilling Ceph daemons; five OomKilled alerts
fired in the week of 2026-09-22, two of them mons.

- Disable the `rook` mgr module. Its get_osds(), get_resource() and device
  fetchers each build a KubernetesResource per call, leaking a watcher
  thread and HTTPS connection every time, so orchestrator polling walks the
  active mgr into its limit (ceph/ceph#71754, not in 20.2.4). Rook
  reconciles through its CRDs and does not need the module; the cost is
  `ceph orch` and the dashboard's orchestrator-backed views.
- Correct the mgr sizing comment. Re-measured at ~95 MB/day over 30d, about
  4x the ~23 MB/day it was tuned for, making 2Gi ~3 weeks of headroom rather
  than the ~2 months claimed. Limit held at 2Gi on the expectation that
  disabling the module above removes most of the growth — re-measure before
  trusting it.
- Add an explicit resources.mon block with a 4Gi limit. This is a separate
  leak: mons do not load mgr modules, and with the cluster HEALTH_OK and
  every PG active+clean each mon still grows ~55-100 MB/day, hitting the
  chart's 2Gi default ~4 weeks after it starts. mon-n (1604 -> 2014 MiB over
  6 days) and mon-o died that way 16h apart. Requests are left at the chart
  defaults so scheduling does not change.

No tentacle-specific mon leak exists upstream, so 4Gi is mitigation, not a
fix. Worth noting the hazard it does not solve: Talos node upgrades restart
all three mons within ~30 minutes of each other, resetting the leak clock in
lockstep, so they age into the ceiling together rather than one at a time.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@batrick batrick modified the milestones: tentacle, v20.2.5 Sep 30, 2026
@batrick
batrick merged commit 0bbfdc0 into ceph:tentacle Sep 30, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants