Apparent memory leaks related to D-Bus responses
Description
LeakSanitizer and Valgrind report DBus-related memory leaks when exiting Thunar and xfce4-taskmanager (xfce4-dev-tools#64).
After investigating, I think these leaks actually stem from xfconf.
Steps to reproduce
valgrind --num-callers=30 --leak-check=full --show-leak-kinds=definite --show-error-list=yes xfconf-query --channel "xfce4-taskmanager" --property "/interface/handle-position"
Debugging
Valgrind output
216 (128 direct, 88 indirect) bytes in 2 blocks are definitely lost in loss record 1,136 of 1,190
at 0x48447A8: malloc (vg_replace_malloc.c:446)
by 0x4ADD5BA: g_malloc (gmem.c:100)
by 0x4B20083: UnknownInlinedFun (gvariant-core.c:560)
by 0x4B20083: g_variant_new_from_bytes (gvariant-core.c:603)
by 0x4B20508: UnknownInlinedFun (gvariant.c:328)
by 0x4B20508: g_variant_new_int32 (gvariant.c:492)
by 0x49F4BF7: parse_value_from_blob.isra.0 (gdbusmessage.c:1757)
by 0x49F52AF: parse_value_from_blob.isra.0 (gdbusmessage.c:2170)
by 0x49F49A0: parse_value_from_blob.isra.0 (gdbusmessage.c:2057)
by 0x49F5089: parse_value_from_blob.isra.0 (gdbusmessage.c:1998)
by 0x49F516F: parse_value_from_blob.isra.0 (gdbusmessage.c:2102)
by 0x49BC023: g_dbus_message_new_from_blob (gdbusmessage.c:2490)
by 0x49C8C47: _g_dbus_worker_do_read_cb (gdbusprivate.c:752)
by 0x49541AB: g_task_return_now (gtask.c:1361)
by 0x49541F4: complete_in_idle_cb (gtask.c:1375)
by 0x4AD7AB8: g_main_dispatch.lto_priv.0 (gmain.c:3344)
by 0x4B399E6: UnknownInlinedFun (gmain.c:4152)
by 0x4B399E6: g_main_context_iterate_unlocked.isra.0 (gmain.c:4217)
by 0x4AD87B6: g_main_loop_run (gmain.c:4419)
by 0x49C0573: gdbus_shared_thread_func.lto_priv.0 (gdbusprivate.c:284)
by 0x4B07265: g_thread_proxy (gthread.c:835)
by 0x4CBE39C: start_thread (pthread_create.c:447)
by 0x4D432A3: clone (clone.S:100)
216 (128 direct, 88 indirect) bytes in 2 blocks are definitely lost in loss record 1,137 of 1,190
at 0x48447A8: malloc (vg_replace_malloc.c:446)
by 0x4ADD5BA: g_malloc (gmem.c:100)
by 0x4B20083: UnknownInlinedFun (gvariant-core.c:560)
by 0x4B20083: g_variant_new_from_bytes (gvariant-core.c:603)
by 0x4B20568: UnknownInlinedFun (gvariant.c:328)
by 0x4B20568: g_variant_new_uint32 (gvariant.c:517)
by 0x49F4E77: parse_value_from_blob.isra.0 (gdbusmessage.c:1769)
by 0x49F52AF: parse_value_from_blob.isra.0 (gdbusmessage.c:2170)
by 0x49F49A0: parse_value_from_blob.isra.0 (gdbusmessage.c:2057)
by 0x49F5089: parse_value_from_blob.isra.0 (gdbusmessage.c:1998)
by 0x49F516F: parse_value_from_blob.isra.0 (gdbusmessage.c:2102)
by 0x49BC023: g_dbus_message_new_from_blob (gdbusmessage.c:2490)
by 0x49C8C47: _g_dbus_worker_do_read_cb (gdbusprivate.c:752)
by 0x49541AB: g_task_return_now (gtask.c:1361)
by 0x49541F4: complete_in_idle_cb (gtask.c:1375)
by 0x4AD7AB8: g_main_dispatch.lto_priv.0 (gmain.c:3344)
by 0x4B399E6: UnknownInlinedFun (gmain.c:4152)
by 0x4B399E6: g_main_context_iterate_unlocked.isra.0 (gmain.c:4217)
by 0x4AD87B6: g_main_loop_run (gmain.c:4419)
by 0x49C0573: gdbus_shared_thread_func.lto_priv.0 (gdbusprivate.c:284)
by 0x4B07265: g_thread_proxy (gthread.c:835)
by 0x4CBE39C: start_thread (pthread_create.c:447)
by 0x4D432A3: clone (clone.S:100)
630 (384 direct, 246 indirect) bytes in 6 blocks are definitely lost in loss record 1,177 of 1,190
at 0x48447A8: malloc (vg_replace_malloc.c:446)
by 0x4ADD5BA: g_malloc (gmem.c:100)
by 0x4B20083: UnknownInlinedFun (gvariant-core.c:560)
by 0x4B20083: g_variant_new_from_bytes (gvariant-core.c:603)
by 0x4B20378: UnknownInlinedFun (gvariant.c:328)
by 0x4B20378: g_variant_new_boolean (gvariant.c:349)
by 0x49F4A7B: parse_value_from_blob.isra.0 (gdbusmessage.c:1710)
by 0x49F52AF: parse_value_from_blob.isra.0 (gdbusmessage.c:2170)
by 0x49F49A0: parse_value_from_blob.isra.0 (gdbusmessage.c:2057)
by 0x49F5089: parse_value_from_blob.isra.0 (gdbusmessage.c:1998)
by 0x49F516F: parse_value_from_blob.isra.0 (gdbusmessage.c:2102)
by 0x49BC023: g_dbus_message_new_from_blob (gdbusmessage.c:2490)
by 0x49C8C47: _g_dbus_worker_do_read_cb (gdbusprivate.c:752)
by 0x49541AB: g_task_return_now (gtask.c:1361)
by 0x49541F4: complete_in_idle_cb (gtask.c:1375)
by 0x4AD7AB8: g_main_dispatch.lto_priv.0 (gmain.c:3344)
by 0x4B399E6: UnknownInlinedFun (gmain.c:4152)
by 0x4B399E6: g_main_context_iterate_unlocked.isra.0 (gmain.c:4217)
by 0x4AD87B6: g_main_loop_run (gmain.c:4419)
by 0x49C0573: gdbus_shared_thread_func.lto_priv.0 (gdbusprivate.c:284)
by 0x4B07265: g_thread_proxy (gthread.c:835)
by 0x4CBE39C: start_thread (pthread_create.c:447)
by 0x4D432A3: clone (clone.S:100)
988 (88 direct, 900 indirect) bytes in 1 blocks are definitely lost in loss record 1,179 of 1,190
at 0x484BC13: calloc (vg_replace_malloc.c:1675)
by 0x4ADE2C2: g_malloc0 (gmem.c:133)
by 0x4ADE318: g_option_context_new (goption.c:208)
by 0x10BD51: main (main.c:244)
dbus-monitor output
method call time=1723385634.196955 sender=:1.230 -> destination=org.freedesktop.DBus serial=1 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=Hello
method return time=1723385634.197056 sender=org.freedesktop.DBus -> destination=:1.230 serial=4294967295 reply_serial=1
string ":1.230"
signal time=1723385634.197102 sender=org.freedesktop.DBus -> destination=(null destination) serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string ":1.230"
string ""
string ":1.230"
signal time=1723385634.197145 sender=org.freedesktop.DBus -> destination=:1.230 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.230"
method call time=1723385634.350110 sender=:1.230 -> destination=org.freedesktop.DBus serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus',arg0='org.xfce.Xfconf'"
method return time=1723385634.351210 sender=org.freedesktop.DBus -> destination=:1.230 serial=4294967295 reply_serial=2
method call time=1723385634.353659 sender=:1.230 -> destination=org.freedesktop.DBus serial=3 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
string "org.xfce.Xfconf"
method return time=1723385634.353758 sender=org.freedesktop.DBus -> destination=:1.230 serial=4294967295 reply_serial=3
string ":1.229"
method call time=1723385634.354039 sender=:1.230 -> destination=org.freedesktop.DBus serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',sender='org.xfce.Xfconf',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',path='/org/xfce/Xfconf',arg0='org.xfce.Xfconf'"
method return time=1723385634.354155 sender=org.freedesktop.DBus -> destination=:1.230 serial=4294967295 reply_serial=4
method call time=1723385634.354905 sender=:1.230 -> destination=org.freedesktop.DBus serial=5 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',sender='org.xfce.Xfconf',interface='org.xfce.Xfconf',path='/org/xfce/Xfconf'"
method return time=1723385634.355033 sender=org.freedesktop.DBus -> destination=:1.230 serial=4294967295 reply_serial=5
method call time=1723385634.376298 sender=:1.230 -> destination=org.freedesktop.DBus serial=6 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=StartServiceByName
string "org.xfce.Xfconf"
uint32 0
method return time=1723385634.376555 sender=org.freedesktop.DBus -> destination=:1.230 serial=4294967295 reply_serial=6
uint32 2
method call time=1723385634.396017 sender=:1.230 -> destination=org.freedesktop.DBus serial=7 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
string "org.xfce.Xfconf"
method return time=1723385634.396340 sender=org.freedesktop.DBus -> destination=:1.230 serial=4294967295 reply_serial=7
string ":1.229"
method call time=1723385634.405719 sender=:1.230 -> destination=:1.229 serial=8 path=/org/xfce/Xfconf; interface=org.freedesktop.DBus.Properties; member=GetAll
string "org.xfce.Xfconf"
method return time=1723385634.406550 sender=:1.229 -> destination=:1.230 serial=18 reply_serial=8
array [
]
method call time=1723385634.451018 sender=:1.230 -> destination=:1.229 serial=9 path=/org/xfce/Xfconf; interface=org.xfce.Xfconf; member=GetAllProperties
string "xfce4-taskmanager"
string "/"
method return time=1723385634.451651 sender=:1.229 -> destination=:1.230 serial=19 reply_serial=9
array [
dict entry(
string "/columns/column-group-cpu"
variant boolean true
)
dict entry(
string "/window-height"
variant int32 727
)
dict entry(
string "/interface/show-application-icons"
variant boolean true
)
dict entry(
string "/columns/sort-id"
variant uint32 7
)
dict entry(
string "/interface/show-all-processes"
variant boolean true
)
dict entry(
string "/window-width"
variant int32 1343
)
dict entry(
string "/window-maximized"
variant boolean false
)
dict entry(
string "/interface/process-tree"
variant boolean false
)
dict entry(
string "/interface/full-command-line"
variant boolean true
)
dict entry(
string "/columns/sort-type"
variant uint32 1
)
]
method call time=1723385634.479043 sender=:1.230 -> destination=:1.229 serial=10 path=/org/xfce/Xfconf; interface=org.xfce.Xfconf; member=GetProperty
string "xfce4-taskmanager"
string "/interface/handle-position"
error time=1723385634.479903 sender=:1.229 -> destination=:1.230 error_name=org.xfce.Xfconf.Error.PropertyNotFound reply_serial=10
string "Property "/interface/handle-position" does not exist on channel "xfce4-taskmanager""
signal time=1723385634.716694 sender=org.freedesktop.DBus -> destination=:1.230 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
string ":1.230"
signal time=1723385634.716976 sender=org.freedesktop.DBus -> destination=(null destination) serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string ":1.230"
string ":1.230"
string ""
Version: b92616d3