LEW21 / pydbus

Pythonic DBus library
GNU Lesser General Public License v2.1
331 stars 75 forks source link

Memory leak in server #83

Open sattlma opened 5 years ago

sattlma commented 5 years ago

Hi,

when I start the a simple pair of client and server application, the used memory of the server application is rising quickly. The example is derived from the supplied "clientserver" example.

The test() method on the com.test service is called by the client via D-Bus repeatedly.

class TestObject(object):
    """
        <node>
            <interface name='com.test'>
                <method name='test'>
                    <arg type='u' name='response' direction='out'/>
                </method>                
            </interface>
        </node>
    """
    def __init__(self, loop):
        self.loop = loop

    def test(self):
        #print("test")
        return 42;

if (__name__ == '__main__'):
    loop = GLib.MainLoop()
    bus = SessionBus()
    bus.publish("com.test", TestObject(loop)
    )
    loop.run()

memtest.zip

Greetings, Matthias

rogerlucas-veea commented 5 years ago

@sattlma I can confirm that the above problem exists, but it doesn't appear on all systems. The above test code doesn't leak on Ubuntu 16.04 or Devuan ASCII (x86 architecture + python3 + default system packages and pydbus installed from pip3) but it does occur (and leaks very badly) on an arm64 embedded system running Alpine 3.8. Can you provide more information about the system that you have found the issue on?

rogerlucas-veea commented 5 years ago

@sattlma I've been digging further on this. I've also reproduced the issue on Alpine v3.8 on x86_64. The leak disappears if py3-gobject3 is downgraded to v3.24.1. If py3-gobject3 is v3.25.1 or later, the leak appears. Unfortunately, there are no releases between these two releases (https://pygobject.readthedocs.io/en/latest/changelog.html).

rogerlucas-veea commented 5 years ago

See https://gitlab.gnome.org/GNOME/pygobject/issues/307