Bug #74693
closedMGR daemon crashes with assertion failure in `PyFormatter.h:84` when the telemetry module attempts to query metadata for a destroyed OSD that still exists in the CRUSH map.
0%
Description
- Environment
- Ceph Version: v20.2.0 Tentacle (stable)
- OS: Rocky Linux (cephadm deployment)
- Affected Components: ceph-mgr, telemetry module
- Description
When an OSD has been destroyed (FSID set to `00000000-0000-0000-0000-000000000000`) but not fully purged from the cluster, the MGR telemetry module periodically attempts to query its metadata. This triggers an assertion failure in `PyFormatter::close_section()` because the formatter attempts to close a section that was never opened (the destroyed OSD has no metadata to format).
The MGR crashes every 60-90 seconds, cycling through all available MGR daemons.
- Assertion Failure
```
/ceph/rpmbuild/BUILD/ceph-20.2.0/src/mgr/PyFormatter.h: 84: FAILED ceph_assert(cursor != root)
```
- Stack Trace
```
Thread: telemetry
ceph::__ceph_assert_fail()
-> PyFormatter::close_section()
-> ActivePyModules::get_perf_schema_python()
```
- Log Messages
```
mgr get_metadata_python Requested missing service osd.123
mgr with_perf_counters Missing counter: 'mds_log.rss' (mds.quick.ssd.osd18.ysqwpx)
```
Note: The "Missing counter" warning is unrelated to the crash but appears in logs around the same time.
- Destroyed OSD State
```bash
$ ceph osd dump | grep osd.123
osd.123 down out weight 0 exists,new 00000000-0000-0000-0000-000000000000
```
The destroyed OSD has:
- FSID: `00000000-0000-0000-0000-000000000000` (null/destroyed marker)
- Status: down, out, weight 0
- No CRUSH location (empty host assignment)
- No network addresses (empty addrvec)
- Steps to Reproduce
1. Have a running Ceph Tentacle v20.2.0 cluster with telemetry module enabled
2. Destroy an OSD but don't purge it from the CRUSH map:
```bash
ceph osd destroy <osd_id> --yes-i-really-mean-it
```
3. Wait 60-90 seconds for telemetry module to query OSD metadata
4. MGR crashes with assertion failure
- Impact
- Severity: High
- MGR daemon crashes repeatedly (every 60-90 seconds)
- All MGR daemons in the cluster are affected
- Cluster health monitoring and management is degraded
- Crash reports fail to post due to MGR instability
ST Updated by Stephen Thompson 10 months ago
- Suggested Fix
In `ActivePyModules::get_perf_schema_python()`, check if the OSD exists and has valid metadata before attempting to format. If the OSD is destroyed (null FSID), skip it or return early without opening/closing formatter sections.
SZ Updated by Steven Zuraski 9 months ago
- Assignee changed from Yaarit Hatuka to Steven Zuraski
SZ Updated by Steven Zuraski 9 months ago
Hey Stephen, could you elaborate the steps you took in order to reproduce this issue? Also, does the assert failure happen every time?
I was able to cause an assert failure inside get_perf_schema_python() with a unit test based on your description. I haven't been seeing this behavior in my test cluster however when destroying an OSD, so I wanted to verify that our order of operations from cluster start to OSD destroy to telemetry send are the same.
ST Updated by Stephen Thompson 9 months ago
This is the process we followed so looks good.
SZ Updated by Steven Zuraski 8 months ago
Hey Stephen, could you rerun with debug set to at least 20, and upload the logs?
ceph config set mgr debug_mgr 20
My destroyed OSD does not have the same result
[ceph: root@ceph-node-0 /]# ceph osd tree
ID CLASS WEIGHT TYPE NAME STATUS REWEIGHT PRI-AFF
-1 0.01959 root default
-5 0 host ceph-node-0
1 hdd 0 osd.1 destroyed 0 1.00000
-3 0.00980 host ceph-node-1
0 hdd 0.00980 osd.0 up 1.00000 1.00000
-7 0.00980 host ceph-node-2
sea 2 hdd 0.00980 osd.2 up 1.00000 1.00000
[ceph: root@ceph-node-0 /]# ceph osd dump | grep "osd.1"
osd.1 down out weight 0 up_from 7 up_thru 12 down_at 18 last_clean_interval [0,0) [v2:192.168.100.100:6802/2501638334,v1:192.168.100.100:6803/2501638334] [v2:192.168.100.100:6804/2501638334,v1:192.168.100.100:6805/2501638334] destroyed,exists,stop
SZ Updated by Steven Zuraski 8 months ago
- Related to Bug #75745: ActivePyModules fails an assert during perf schema generation when an OSD exists but has no perf counters. added
YH Updated by Yaarit Hatuka 6 months ago
- Backport set to tentacle, umbrella
SZ Updated by Steven Zuraski 6 months ago
- Related to Bug #77384: Enhance telemetry upgrade tests to verify perf schema collection added
SZ Updated by Steven Zuraski 6 months ago
- Related to Bug #77540: Misaligned OSD perf counters within the Mgr added
SZ Updated by Steven Zuraski 4 months ago
- Pull request ID changed from 67156 to 69181
SZ Updated by Steven Zuraski 4 months ago
- Status changed from Fix Under Review to Pending Backport
UB Updated by Upkeep Bot 4 months ago
- Copied to Backport #78617: tentacle: MGR daemon crashes with assertion failure in `PyFormatter.h:84` when the telemetry module attempts to query metadata for a destroyed OSD that still exists in the CRUSH map. added
UB Updated by Upkeep Bot 4 months ago
- Copied to Backport #78618: umbrella: MGR daemon crashes with assertion failure in `PyFormatter.h:84` when the telemetry module attempts to query metadata for a destroyed OSD that still exists in the CRUSH map. added
UB Updated by Upkeep Bot 4 months ago
- Tags (freeform) set to backport_processed
UB Updated by Upkeep Bot 4 months ago
- Merge Commit set to 635a92806d102a6b0a8349c9699b0515871604ef
- Fixed In set to v21.3.0-1331-g635a92806d
- Upkeep Timestamp set to 2026-07-24T01:01:54+00:00
SZ Updated by Steven Zuraski 4 months ago
- Related to Feature #79553: Add QA tests for get_perf_schema / get_unlabeled_perf_schema paths added
SZ Updated by Steven Zuraski 3 months ago
- Status changed from Pending Backport to Resolved
UB Updated by Upkeep Bot 3 months ago
- Tags (freeform) deleted (
backport_processed) - Upkeep Timestamp changed from 2026-07-24T01:01:54+00:00 to 2026-08-28T01:42:12+00:00