From: Geoff Parker <geoffrey.par...@arthrex.com> Memory leak and OOM in our code involving dbus was traced to a resource leak in python3-gobject above v3.24.1 noted in these links.
https://github.com/LEW21/pydbus/issues/83 https://gitlab.gnome.org/GNOME/pygobject/-/issues/307 This patch fixed the leak for us. This issue has existed at least 3 years. The author of this patch opened an issue 2 years ago on the upstream pygobject gnome project and submitted this patch a year ago. The maintainer seems unresponsive, since the last upstream change to the affected file was on 2020-04-15. Signed-off-by: Geoff Parker <geoffrey.par...@arthrex.com> --- ...d-to-fix-the-invocation-object-leaks.patch | 40 +++++++++++++++++++ .../python/python3-pygobject_3.42.0.bb | 1 + 2 files changed, 41 insertions(+) create mode 100644 meta/recipes-devtools/python/python3-pygobject/0002-workaround-to-fix-the-invocation-object-leaks.patch diff --git a/meta/recipes-devtools/python/python3-pygobject/0002-workaround-to-fix-the-invocation-object-leaks.patch b/meta/recipes-devtools/python/python3-pygobject/0002-workaround-to-fix-the-invocation-object-leaks.patch new file mode 100644 index 0000000000..51832aaf55 --- /dev/null +++ b/meta/recipes-devtools/python/python3-pygobject/0002-workaround-to-fix-the-invocation-object-leaks.patch @@ -0,0 +1,40 @@ +From 3da1eaaa891b7dfdba57b16c079ff8c6100ebb45 Mon Sep 17 00:00:00 2001 +From: Frederic Martinsons <frederic.martins...@gmail.com> +Date: Fri, 15 Jan 2021 07:24:37 +0100 +Subject: [PATCH] Workaround to fix the invocation object leaks + +See https://gitlab.gnome.org/GNOME/pygobject/-/issues/307 for description + +Signed-off-by: Frederic Martinsons <frederic.martins...@gmail.com> +--- + gi/pygi-object.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/gi/pygi-object.c b/gi/pygi-object.c +index 00b36c1b..5ca45975 100644 +--- a/gi/pygi-object.c ++++ b/gi/pygi-object.c +@@ -213,8 +213,18 @@ _pygi_marshal_cleanup_from_py_interface_object (PyGIInvokeState *state, + /* If we processed the parameter but fail before invoking the method, + we need to remove the ref we added */ + if (was_processed && state->failed && data != NULL && +- arg_cache->transfer == GI_TRANSFER_EVERYTHING) ++ arg_cache->transfer == GI_TRANSFER_EVERYTHING) { + g_object_unref (G_OBJECT(data)); ++ return; ++ } ++ ++ /* BAD hack to solve https://gitlab.gnome.org/GNOME/pygobject/-/issues/307 */ ++ if (was_processed && data != NULL && arg_cache->transfer == GI_TRANSFER_EVERYTHING) { ++ GObject* obj = G_OBJECT(data); ++ if (!g_strcmp0(G_OBJECT_TYPE_NAME(obj), "GDBusMethodInvocation") && obj->ref_count > 1) { ++ g_object_unref (G_OBJECT(data)); ++ } ++ } + } + + +-- +2.25.1 + + diff --git a/meta/recipes-devtools/python/python3-pygobject_3.42.0.bb b/meta/recipes-devtools/python/python3-pygobject_3.42.0.bb index 74318337ba..7923f1ef6b 100644 --- a/meta/recipes-devtools/python/python3-pygobject_3.42.0.bb +++ b/meta/recipes-devtools/python/python3-pygobject_3.42.0.bb @@ -17,6 +17,7 @@ SRCNAME="pygobject" SRC_URI = " \ http://ftp.gnome.org/pub/GNOME/sources/${SRCNAME}/${@gnome_verdir("${PV}")}/${SRCNAME}-${PV}.tar.xz \ file://0001-Do-not-build-tests.patch \ + file://0002-workaround-to-fix-the-invocation-object-leaks.patch \ " SRC_URI[sha256sum] = "9b12616e32cfc792f9dc841d9c472a41a35b85ba67d3a6eb427e307a6fe4367b" -- 2.30.2
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#161378): https://lists.openembedded.org/g/openembedded-core/message/161378 Mute This Topic: https://lists.openembedded.org/mt/88914094/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-