fix inheritance order of FaultLog
The destructor order is incorrect which caused the ObjectMapper to not
see all the interfaces removed... eventually causing OOM in Object
Mapper. Reorder it to make sure we remove the object in the right order.
https://stackoverflow.com/questions/31518581/order-of-destruction-in-the-case-of-multiple-inheritance
The InterfacesRemoved signal now remove all the interface added, so the
object mapper will remove the entry entirely instead of keeping it in
the hashmap.
```
signal time=1738283381.202322 sender=:1.3856 -> destination=(null destination) serial=466 path=/xyz/openbmc_project/dump; interface=org.freedesktop.DBus.ObjectManager; member=InterfacesRemoved
object path "/xyz/openbmc_project/dump/faultlog/entry/44"
array [
string "org.freedesktop.DBus.Peer"
string "org.freedesktop.DBus.Introspectable"
string "org.freedesktop.DBus.Properties"
string "xyz.openbmc_project.Dump.Entry.FaultLog"
string "xyz.openbmc_project.Time.EpochTime"
string "xyz.openbmc_project.Object.Delete"
string "xyz.openbmc_project.Dump.Entry"
string "xyz.openbmc_project.Common.Progress"
string "xyz.openbmc_project.Common.OriginatedBy"
]
```
Tested: The logs are still detected by the ObjectMapper properly and
found via bmcweb.
```
$ curl -s http://localhost:80/redfish/v1/Managers/bmc/LogServices/FaultLog/Entries | jq ".Members | length"
273
```
Spamming of CEPR logs and now Object Mapper still does not increase the
memory usage significantly. Spammed for 6 hours+.
Start:
```
$ systemctl status xyz.openbmc_project.ObjectMapper
● xyz.openbmc_project.ObjectMapper.service - Phosphor DBus Service Discovery Manager
Loaded: loaded (/usr/lib/systemd/system/xyz.openbmc_project.ObjectMapper.service; enabled; preset: enabled)
Active: active (running) since Fri 2025-01-31 01:08:27 PST; 12s ago
Invocation: 6e615edea66e4351baa132533d2ccdc0
Main PID: 3285 (mapperx)
Memory: 4.3M
CPU: 2.470s
CGroup: /system.slice/xyz.openbmc_project.ObjectMapper.service
└─3285 /tmp/mapperx
```
End:
```
$ systemctl status xyz.openbmc_project.ObjectMapper
● xyz.openbmc_project.ObjectMapper.service - Phosphor DBus Service Discovery Manager
Loaded: loaded (/usr/lib/systemd/system/xyz.openbmc_project.ObjectMapper.service; enabled; preset: enabled)
Active: active (running) since Fri 2025-01-31 01:08:27 PST; 6h ago
Invocation: 6e615edea66e4351baa132533d2ccdc0
Main PID: 3285 (mapperx)
Memory: 8.1M
CPU: 29min 15.200s
CGroup: /system.slice/xyz.openbmc_project.ObjectMapper.service
└─3285 /tmp/mapperx
```
Fusion-Link: fusion2 link N/A. This change doesn't affect exiting presubmit tests.
Google-Bug-Id: 393174995
Platforms-Affected: TTF gBMC
Change-Id: I731d4421e29672696294f2c9eec99fce2f744c19
Signed-off-by: Willy Tu <wltu@google.com>
(cherry picked from commit 460a5269327b21ce93192d1619fe138caaf6231a)
diff --git a/recipes-phosphor/dump/phosphor-debug-collector/0001-Add-CPER-Log-and-Crashdump-support-in-FaultLog.patch b/recipes-phosphor/dump/phosphor-debug-collector/0001-Add-CPER-Log-and-Crashdump-support-in-FaultLog.patch
index cdd5e37..b0b97b2 100644
--- a/recipes-phosphor/dump/phosphor-debug-collector/0001-Add-CPER-Log-and-Crashdump-support-in-FaultLog.patch
+++ b/recipes-phosphor/dump/phosphor-debug-collector/0001-Add-CPER-Log-and-Crashdump-support-in-FaultLog.patch
@@ -1,7 +1,7 @@
-From aad7501b22745f29e045d0be847ef5573b57c509 Mon Sep 17 00:00:00 2001
+From a74a109d5ff5d3024e1bc8785145ded07adc188f Mon Sep 17 00:00:00 2001
From: Claire Weinan <cweinan@google.com>
Date: Tue, 26 Jul 2022 10:50:34 -0700
-Subject: [PATCH 1/2] Add CPER Log and Crashdump support in FaultLog
+Subject: [PATCH] Add CPER Log and Crashdump support in FaultLog
The fault log manager (in the phosphor-debug-collector module) receives
D-Bus signals to be notified when new CPER logs and crashdumps are
@@ -60,6 +60,7 @@
Justification: Enable fault log for Fault Management/Agentless error
Signed-off-by: Claire Weinan <cweinan@google.com>
+Signed-off-by: Willy Tu <wltu@google.com>
---
dump_manager.hpp | 6 +-
dump_manager_faultlog.cpp | 377 +++++++++++++++++++++++++++++++++++---
@@ -652,7 +653,7 @@
} // namespace faultlog
diff --git a/faultlog_dump_entry.hpp b/faultlog_dump_entry.hpp
-index 3e5b53a..5dfc62b 100644
+index 3e5b53a..0d49dfd 100644
--- a/faultlog_dump_entry.hpp
+++ b/faultlog_dump_entry.hpp
@@ -4,6 +4,9 @@
@@ -681,7 +682,7 @@
* @brief OpenBMC Fault Log Dump Entry implementation.
*/
-class Entry : virtual public phosphor::dump::Entry
-+class Entry : virtual public EntryIfaces, virtual public phosphor::dump::Entry
++class Entry : virtual public phosphor::dump::Entry, virtual public EntryIfaces
{
+ friend class Manager;
+
@@ -705,12 +706,12 @@
+ originatorTypes originatorType, FaultLogTypes entryType,
+ const std::string& primaryLogIdStr, phosphor::dump::Manager& parent,
+ std::map<uint32_t, std::unique_ptr<phosphor::dump::Entry>>* parentMap) :
-+ EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit),
phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, fileSize,
file, status, originatorId, originatorType,
- parent)
- {}
+ parent),
++ EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit),
+ parentMap(parentMap)
+ {
+ type(entryType);
@@ -821,5 +822,5 @@
# System dump options
--
-2.46.0.184.g6999bdac58-goog
+2.48.1.362.g079036d154-goog