Repository navigation
mgr: forward the root-logger fallback at the record's own level - #70146
Conversation
MgrRootHandler captures third-party logs from the Python root logger and emits them through the _ceph_log method of whichever mgr module last configured logging. A handler on the root logger outlives any single module, so once that module unloads the handler emits through a stale pointer until another module reconfigures logging. Add a free mgr_log() function to the ceph_module binding, emitting via dout() like PyModuleRunner::log but with no PyModule involved, and rewrite MgrRootHandler to route through it. The handler no longer references a module instance, so it cannot go stale. Signed-off-by: Kefu Chai <[email protected]>
ceph_module.mgr_log() emitted every record at dout(0): a record either passed the Python-side gate and went unconditionally to both the log file and the in-memory recent buffer, or never reached the C++ log at all. The two-level debug_mgr semantics (file level / memory level) never applied, so capturing third-party DEBUG logs meant sending each record to the log file and a log_max_recent slot; with the kubernetes client logging multi-megabyte HTTP response bodies at DEBUG, the recent buffer alone could grow to tens of gigabytes. Pass the record's level through mgr_log() and emit at the mapped ceph level: CRITICAL/ERROR at 0, WARNING at 1, INFO at 2, DEBUG at 20. INFO maps to 2 so it stays visible in the log file at the default debug_mgr=2/5; DEBUG maps to 20 so floods are dropped there, while debug_mgr=2/20 captures third-party DEBUG in the in-memory buffer without touching the log file. The Python-side gate follows the higher of the two debug_mgr levels so memory-only records still reach the C++ side. Fixes: https://tracker.ceph.com/issues/77633 Signed-off-by: Kefu Chai <[email protected]>
1530e07 to
e61de15
Compare
|
@mheler hi Matthew, could you help review this change, i think we should step further and get the mgr a finer-grained python logging support. |
|
This PR has been added to main integration testing by skanta started 2026-07-15-06:32. |
|
This PR has been added to main integration testing by skanta started 2026-07-17-04:58. |
|
@tchaikov Since there is no tracker https://tracker.ceph.com/issues/77633 is already have another pr in it #70071 do we need new tracker for that PR? so we won't miss backports? |
|
@NitzanMordhai hi Nitzan, thanks for your suggestion. indeed, it turns out #70071 helps with fixing the memleak, but that PR only touches the tip of the iceberg. the backport of https://tracker.ceph.com/issues/77538 's fix is the right minimal fix. but IMHO, this fix is a more elegant, but a more intrusive change. i created https://tracker.ceph.com/issues/78589 to track the "iceberg" tip fix. and leave https://tracker.ceph.com/issues/77633 for this PR. |
|
Thanks @tchaikov ! i think that the confusion was due to that line in the commit: |
ceph_module.mgr_log()emitted every record atdout(0): a record either passed the Python-side gate and went unconditionally to both the log file and the in-memory recent buffer, or never reached the C++ log atall. The two-level debug_mgr semantics (file level / memory level) never applied, so capturing third-party
DEBUGlogs meant sending each record to the log file and a log_max_recent slot; with the kubernetes client logging multi-megabyte HTTP response bodies at DEBUG, the recent buffer alone could grow to tens of gigabytes.Pass the record's level through
mgr_log()and emit at the mapped ceph level:CRITICAL/ERRORat 0,WARNINGat 1,INFOat 2,DEBUGat 20. Iso it stays visible in the log file at the default
debug_mgr=2/5; DEBUG maps to 20 so floods are dropped there, while debug_mgr=2/20 captures third-party DEBUG in the in-memory buffer without touching the log file. The Python-side gate follows the higher of the two debug_mgr levels so memory-only records still reach the C++ side.Fixes: https://tracker.ceph.com/issues/77633
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.