From ec837446c1ebcf45b44d61c4a3b2e361e9913d06 Mon Sep 17 00:00:00 2001
From: Antonio Rojas <arojas@archlinux.org>
Date: Sat, 5 Jul 2025 19:52:31 +0000
Subject: [PATCH] Do not emit OOM notifications on systemd services reload

When systemd services are reloaded, systemd emits all PropertiesChanged signals for all units.

Comparing with the original signals these have a null MainPID, so we can use that to identify them and not emit a notification.

BUG: 502279


(cherry picked from commit ce33b24d4f1b5711f7585b33822ab87f2f43af0b)

ce33b24d Do not emit OOM notifications on systemd services reload

Co-authored-by: Antonio Rojas <arojas@archlinux.org>
---
 oom-notifier/module.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/oom-notifier/module.cpp b/oom-notifier/module.cpp
index 64cf322bc7..127b8d22ee 100644
--- a/oom-notifier/module.cpp
+++ b/oom-notifier/module.cpp
@@ -57,6 +57,9 @@ public:
                     if (changed.value(u"Result"_s, QString()) != "oom-kill"_L1) {
                         return;
                     }
+                    if (changed.value(u"MainPID"_s) == 0) {
+                        return;
+                    }
 
                     const auto unit = decodeUnitName(QFileInfo(msg.path()).fileName());
                     const auto service = serviceForUnitName(unit);
-- 
GitLab

