Ceph RECENT_CRASH: "daemons have recently crashed" fix
Ceph RECENT_CRASH "daemons have recently crashed" means unarchived crashes from the last two weeks. Read them with crash ls-new and info, save, then archive.
health_checks['RECENT_CRASH'] = { 'severity': 'warning', 'summary': '%d daemons have recently crashed' % (daemon_num),RECENT_CRASH (N daemons have recently crashed) means a daemon died recently and the administrator has not yet acknowledged (archived) the crash report. "Recently" defaults to two weeks. Even if the daemon is running again, the warning stays until you archive the report or two weeks pass. Read and save the report first, then clear it with ceph crash archive. Doing it the other way round hides a daemon that keeps crashing.
The block above is the source of the mgr crash module that raises this check. One detail line of the form '%s crashed on host %s at %s' (daemon name, host, time) is built per crash report, and N is not the number of crashed daemons but the number of those lines, that is, unarchived crash reports ([crash/module.py L111-L150, v19.2.7](https://github.com/ceph/ceph/blob/v19.2.7/src/pybind/mgr/crash/module.py#L111-L150)). If the same OSD crashes three times within two weeks, you see 3 daemons have recently crashed. An N larger than the number of distinct daemons is itself the repeat signal from [4].
[1] See which daemon crashed and when. All commands here are read-only.
$ ceph health detail$ ceph crash ls-newThe lines under RECENT_CRASH in ceph health detail give the daemon name (such as osd.12), host and time. ceph crash ls-new lists the IDs (timestamp plus UUID) of crashes not yet acknowledged. If RECENT_MGR_MODULE_CRASH shows up as well, a single mgr module crashed rather than a whole daemon. The docs say this usually means a software bug in that module and the other modules keep working. The commands to inspect and archive are the same.
[2] Read one crash in full and save it. ceph crash info prints everything stored for that crash as JSON ([do_info L218-L230](https://github.com/ceph/ceph/blob/v19.2.7/src/pybind/mgr/crash/module.py#L218-L230)).
$ ceph crash info <crash-id> > crash-<crash-id>.jsonArchiving does not delete the report, but reports are purged automatically after a year (table in [6]), and you will want the JSON at hand when upgrading or searching the tracker for the same symptom.
[3] Check whether the daemon is alive now. The warning is about the crash record, not the current state. Look for other codes such as OSD_DOWN in ceph health detail, and check in ceph -s that the daemon is up. If it is still down, deal with that warning first.
[4] Check for repeats. ceph crash ls shows every report including archived ones, and ceph crash stat groups the count into reports older than 1, 3 and 7 days ([do_stat L370-L420](https://github.com/ceph/ceph/blob/v19.2.7/src/pybind/mgr/crash/module.py#L370-L420)).
$ ceph crash ls$ ceph crash statIf the same daemon, or daemons on the same host, keep appearing a few days apart, do not archive them away; put the JSON files from [2] side by side and investigate. If it was a one-off, go to [5].
[5] Once the cause is recorded, archive the report to clear the warning.
$ ceph crash archive <crash-id>$ ceph crash archive-allarchive stamps the report with an archive time and drops it from the RECENT_CRASH calculation; it does not delete anything. Archived reports still appear in ceph crash ls and disappear only from ceph crash ls-new. archive-all archives every new report at once, so use it only after reading the whole list from [1].
[6] Also check the case where no warning appears. If a daemon died but ceph crash ls is empty, check the collection path. Per the docs, crash dumps go to /var/lib/ceph/crash on each host by default, and ceph-crash.service watches that directory and uploads them with ceph crash post. Uploading needs a keyring for client.crash.$hostname, client.crash or client.admin in /etc/ceph.
| Option | Default | Meaning |
|---|---|---|
mgr/crash/warn_recent_interval | 2 weeks (1,209,600 s) | Only unarchived crashes within this window raise the warning |
mgr/crash/retain_interval | 1 year | Older reports are purged automatically |
Defaults come from the module options, L41-L54. The docs also describe setting warn_recent_interval to 0 to disable the alert entirely, but then the next crash will not show up as a warning either. Clear accumulated warnings by archiving.
For other warning codes, see ceph health detail: read the output and HEALTH_WARN codes.