Skip to content

mgr: guard close_section calls in get_perf_schema_python - #68213

Merged
SrinivasaBharath merged 1 commit into
ceph:mainfrom
lumir-sliva:fix/mgr-perf-schema-empty-counters
May 19, 2026
Merged

SrinivasaBharath merged 1 commit into
ceph:mainfrom
lumir-sliva:fix/mgr-perf-schema-empty-counters

Conversation

@lumir-sliva

Copy link
Copy Markdown
Contributor

Problem

get_perf_schema_python in ActivePyModules.cc crashes with an assertion
failure when iterating daemons that have no perf counters. This happens when
a daemon (e.g. an OSD) was running and registered in the daemon state map,
but is now down or destroyed — its perf_counters.instances map is empty.

The function unconditionally calls f.close_section() twice after the perf
counter loop to close the counters and counter object sections. When the
loop never executes (empty instances), no sections were opened, and the close
calls trigger FAILED ceph_assert(cursor != root) in PyFormatter.h:85.

This was introduced in PR #66824 (perf schema labels rewrite, merged 2026-03-30).

Fix

Add the same if (!prev_key_name.empty()) guard that already protects the
close_section() calls inside the loop (line 1243), so we only close
sections that were actually opened.

Reproduction

On a vstart dev cluster, stop an OSD so it remains in the daemon state map
with empty perf counters, then call get_perf_schema("osd", "") via the
selftest module:

Before fix — mgr asserts:

[selftest INFO selftest] Testing get_perf_schema for all OSDs...
/home/ubuntu/ceph/src/mgr/PyFormatter.h: 85: FAILED ceph_assert(cursor != root)

 ceph version 18a5c0268d umbrella (dev - Debug)
 1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x129)
 2: (ceph::__ceph_assert_fail(ceph::assert_data const&)+0x1b)
 4: (PyFormatter::close_section()+0x48)
 7: (ActivePyModules::get_perf_schema_python(...)+0x245)

After fix — succeeds:

[selftest INFO selftest] Testing get_perf_schema for all OSDs...
[selftest INFO selftest] get_perf_schema returned 3 entries

Tracker: https://tracker.ceph.com/issues/75745

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
    • Includes unit test(s)
    • Includes integration test(s)
    • Includes bug reproducer
    • No tests

When a daemon exists in the daemon state map but has no perf counters
(e.g. an OSD that was running but is now down or destroyed), the loop
in get_perf_schema_python never executes, leaving prev_key_name empty
and no formatter sections opened. The unconditional close_section()
calls after the loop then trigger an assertion failure in PyFormatter
(cursor != root).

Add the same `if (!prev_key_name.empty())` guard that already protects
the close_section() calls inside the loop, so we only close sections
that were actually opened.

Fixes: https://tracker.ceph.com/issues/75745
Signed-off-by: Lumir Sliva <[email protected]>
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

14 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@lumir-sliva
lumir-sliva marked this pull request as ready for review April 4, 2026 15:29

@tchaikov tchaikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tchaikov

tchaikov commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

ok to test

@tchaikov

tchaikov commented May 6, 2026

Copy link
Copy Markdown
Contributor

jenkins test make check

@tchaikov

tchaikov commented May 6, 2026

Copy link
Copy Markdown
Contributor

jenkins test make check arm6

@tchaikov

tchaikov commented May 6, 2026

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

@sseshasa

sseshasa commented May 7, 2026

Copy link
Copy Markdown
Contributor

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

jenkins test dashboard cephadm

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

jenkins test rook e2e

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

jenkins test dashboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants