Summary: | Memory leak | ||
---|---|---|---|
Product: | ConsoleKit | Reporter: | Colin Jones <colinjones71> |
Component: | Daemon | Assignee: | william.jon.mccann |
Status: | NEW --- | QA Contact: | |
Severity: | normal | ||
Priority: | high | CC: | andersk, arv_bua_mharald, colinjones71, freedesktop, smurf |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | patches for a few bad memory leaks |
Description
Colin Jones
2010-01-25 13:04:11 UTC
pmap seems to indicate something weird... libraries are being mapped with 2MB chunks each with no permissions against them. colin@iluvatar:~$ sudo pmap -d 891 891: /usr/sbin/console-kit-daemon Address Kbytes Mode Offset Device Mapping 0000000000400000 128 r-x-- 0000000000000000 008:00001 console-kit-daemon 000000000061f000 4 r---- 000000000001f000 008:00001 console-kit-daemon 0000000000620000 4 rw--- 0000000000020000 008:00001 console-kit-daemon 0000000001af3000 36980 rw--- 0000000000000000 000:00000 [ anon ] 00007f4778000000 33188 rw--- 0000000000000000 000:00000 [ anon ] 00007f477a069000 32348 ----- 0000000000000000 000:00000 [ anon ] 00007f4780000000 38020 rw--- 0000000000000000 000:00000 [ anon ] 00007f4782521000 27516 ----- 0000000000000000 000:00000 [ anon ] 00007f4785ead000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4785eae000 10240 rw--- 0000000000000000 000:00000 [ anon ] 00007f47868ae000 88 r-x-- 0000000000000000 008:00001 libgcc_s.so.1 00007f47868c4000 2044 ----- 0000000000016000 008:00001 libgcc_s.so.1 00007f4786ac3000 4 r---- 0000000000015000 008:00001 libgcc_s.so.1 00007f4786ac4000 4 rw--- 0000000000016000 008:00001 libgcc_s.so.1 00007f4786ade000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786adf000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786aef000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786af0000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786b00000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786b01000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786b11000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786b12000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786b22000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786b23000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786b33000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786b34000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786b44000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786b45000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786b55000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786b56000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786b66000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786b67000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786b77000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786b78000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786b88000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786b89000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786b99000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786b9a000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786baa000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786bab000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786bbb000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786bbc000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786bcc000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786bcd000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786bdd000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786bde000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786bee000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786bef000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786bff000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786c00000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786c10000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786c11000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786c21000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786c22000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786c32000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786c33000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786c43000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786c44000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786c54000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786c55000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786c65000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786c66000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786c76000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786c77000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786c87000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786c88000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786c98000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786c99000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786ca9000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786caa000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786cba000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786cbb000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786ccb000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786ccc000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786cdc000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786cdd000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786ced000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786cee000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786cfe000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4786cff000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786d0f000 112 r-x-- 0000000000000000 008:00001 libselinux.so.1 00007f4786d2b000 2044 ----- 000000000001c000 008:00001 libselinux.so.1 00007f4786f2a000 4 r---- 000000000001b000 008:00001 libselinux.so.1 00007f4786f2b000 4 rw--- 000000000001c000 008:00001 libselinux.so.1 00007f4786f2c000 4 rw--- 0000000000000000 000:00000 [ anon ] 00007f4786f2d000 88 r-x-- 0000000000000000 008:00001 libresolv-2.10.1.so 00007f4786f43000 2044 ----- 0000000000016000 008:00001 libresolv-2.10.1.so 00007f4787142000 4 r---- 0000000000015000 008:00001 libresolv-2.10.1.so 00007f4787143000 4 rw--- 0000000000016000 008:00001 libresolv-2.10.1.so 00007f4787144000 8 rw--- 0000000000000000 000:00000 [ anon ] 00007f4787146000 8 r-x-- 0000000000000000 008:00001 libdl-2.10.1.so 00007f4787148000 2048 ----- 0000000000002000 008:00001 libdl-2.10.1.so 00007f4787348000 4 r---- 0000000000002000 008:00001 libdl-2.10.1.so 00007f4787349000 4 rw--- 0000000000003000 008:00001 libdl-2.10.1.so 00007f478734a000 268 r-x-- 0000000000000000 008:00001 libeggdbus-1.so.0.0.0 00007f478738d000 2048 ----- 0000000000043000 008:00001 libeggdbus-1.so.0.0.0 00007f478758d000 8 r---- 0000000000043000 008:00001 libeggdbus-1.so.0.0.0 00007f478758f000 4 rw--- 0000000000045000 008:00001 libeggdbus-1.so.0.0.0 00007f4787590000 180 r-x-- 0000000000000000 008:00001 libpcre.so.3.12.1 00007f47875bd000 2044 ----- 000000000002d000 008:00001 libpcre.so.3.12.1 00007f47877bc000 4 r---- 000000000002c000 008:00001 libpcre.so.3.12.1 00007f47877bd000 4 rw--- 000000000002d000 008:00001 libpcre.so.3.12.1 00007f47877be000 1432 r-x-- 0000000000000000 008:00001 libc-2.10.1.so 00007f4787924000 2044 ----- 0000000000166000 008:00001 libc-2.10.1.so 00007f4787b23000 16 r---- 0000000000165000 008:00001 libc-2.10.1.so 00007f4787b27000 4 rw--- 0000000000169000 008:00001 libc-2.10.1.so 00007f4787b28000 20 rw--- 0000000000000000 000:00000 [ anon ] 00007f4787b2d000 788 r-x-- 0000000000000000 008:00001 libglib-2.0.so.0.2200.3 00007f4787bf2000 2044 ----- 00000000000c5000 008:00001 libglib-2.0.so.0.2200.3 00007f4787df1000 4 r---- 00000000000c4000 008:00001 libglib-2.0.so.0.2200.3 00007f4787df2000 4 rw--- 00000000000c5000 008:00001 libglib-2.0.so.0.2200.3 00007f4787df3000 4 rw--- 0000000000000000 000:00000 [ anon ] 00007f4787df4000 12 r-x-- 0000000000000000 008:00001 libgmodule-2.0.so.0.2200.3 00007f4787df7000 2044 ----- 0000000000003000 008:00001 libgmodule-2.0.so.0.2200.3 00007f4787ff6000 4 r---- 0000000000002000 008:00001 libgmodule-2.0.so.0.2200.3 00007f4787ff7000 4 rw--- 0000000000003000 008:00001 libgmodule-2.0.so.0.2200.3 00007f4787ff8000 272 r-x-- 0000000000000000 008:00001 libgobject-2.0.so.0.2200.3 00007f478803c000 2048 ----- 0000000000044000 008:00001 libgobject-2.0.so.0.2200.3 00007f478823c000 4 r---- 0000000000044000 008:00001 libgobject-2.0.so.0.2200.3 00007f478823d000 4 rw--- 0000000000045000 008:00001 libgobject-2.0.so.0.2200.3 00007f478823e000 4 rw--- 0000000000000000 000:00000 [ anon ] 00007f478823f000 664 r-x-- 0000000000000000 008:00001 libgio-2.0.so.0.2200.3 00007f47882e5000 2048 ----- 00000000000a6000 008:00001 libgio-2.0.so.0.2200.3 00007f47884e5000 8 r---- 00000000000a6000 008:00001 libgio-2.0.so.0.2200.3 00007f47884e7000 4 rw--- 00000000000a8000 008:00001 libgio-2.0.so.0.2200.3 00007f47884e8000 4 rw--- 0000000000000000 000:00000 [ anon ] 00007f47884e9000 116 r-x-- 0000000000000000 008:00001 libpolkit-gobject-1.so.0.0.0 00007f4788506000 2048 ----- 000000000001d000 008:00001 libpolkit-gobject-1.so.0.0.0 00007f4788706000 4 r---- 000000000001d000 008:00001 libpolkit-gobject-1.so.0.0.0 00007f4788707000 4 rw--- 000000000001e000 008:00001 libpolkit-gobject-1.so.0.0.0 00007f4788708000 28 r-x-- 0000000000000000 008:00001 librt-2.10.1.so 00007f478870f000 2044 ----- 0000000000007000 008:00001 librt-2.10.1.so 00007f478890e000 4 r---- 0000000000006000 008:00001 librt-2.10.1.so 00007f478890f000 4 rw--- 0000000000007000 008:00001 librt-2.10.1.so 00007f4788910000 16 r-x-- 0000000000000000 008:00001 libgthread-2.0.so.0.2200.3 00007f4788914000 2044 ----- 0000000000004000 008:00001 libgthread-2.0.so.0.2200.3 00007f4788b13000 4 r---- 0000000000003000 008:00001 libgthread-2.0.so.0.2200.3 00007f4788b14000 4 rw--- 0000000000004000 008:00001 libgthread-2.0.so.0.2200.3 00007f4788b15000 92 r-x-- 0000000000000000 008:00001 libpthread-2.10.1.so 00007f4788b2c000 2044 ----- 0000000000017000 008:00001 libpthread-2.10.1.so 00007f4788d2b000 4 r---- 0000000000016000 008:00001 libpthread-2.10.1.so 00007f4788d2c000 4 rw--- 0000000000017000 008:00001 libpthread-2.10.1.so 00007f4788d2d000 16 rw--- 0000000000000000 000:00000 [ anon ] 00007f4788d31000 244 r-x-- 0000000000000000 008:00001 libdbus-1.so.3.4.0 00007f4788d6e000 2048 ----- 000000000003d000 008:00001 libdbus-1.so.3.4.0 00007f4788f6e000 4 r---- 000000000003d000 008:00001 libdbus-1.so.3.4.0 00007f4788f6f000 4 rw--- 000000000003e000 008:00001 libdbus-1.so.3.4.0 00007f4788f70000 128 r-x-- 0000000000000000 008:00001 libdbus-glib-1.so.2.1.0 00007f4788f90000 2048 ----- 0000000000020000 008:00001 libdbus-glib-1.so.2.1.0 00007f4789190000 4 r---- 0000000000020000 008:00001 libdbus-glib-1.so.2.1.0 00007f4789191000 4 rw--- 0000000000021000 008:00001 libdbus-glib-1.so.2.1.0 00007f4789192000 124 r-x-- 0000000000000000 008:00001 ld-2.10.1.so 00007f47891b1000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f47891b2000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f47891c2000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f47891c3000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f47891d3000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f47891d4000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f47891e4000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f47891e5000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f47891f5000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f47891f6000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4789206000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4789207000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4789217000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4789218000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4789228000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4789229000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4789239000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f478923a000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f478924a000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f478924b000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f478925b000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f478925c000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f478926c000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f478926d000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f478927d000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f478927e000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f478928e000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f478928f000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f478929f000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f47892a0000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f47892b0000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f47892b1000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f47892c1000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f47892c2000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f47892d2000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f47892d3000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f47892e3000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f47892e4000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f47892f4000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f47892f5000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4789305000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4789306000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4789316000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4789317000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4789327000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4789328000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4789338000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4789339000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f4789349000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f478934a000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f478935a000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f478935b000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f478936b000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f478936c000 64 rw--- 0000000000000000 000:00000 [ anon ] 00007f478937c000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f478937d000 92 rw--- 0000000000000000 000:00000 [ anon ] 00007f4789394000 4 ----- 0000000000000000 000:00000 [ anon ] 00007f4789395000 68 rw--- 0000000000000000 000:00000 [ anon ] 00007f47893a6000 28 r--s- 0000000000000000 008:00001 gconv-modules.cache 00007f47893ad000 12 rw--- 0000000000000000 000:00000 [ anon ] 00007f47893b0000 4 r---- 000000000001e000 008:00001 ld-2.10.1.so 00007f47893b1000 4 rw--- 000000000001f000 008:00001 ld-2.10.1.so 00007fff43106000 84 rw--- 0000000000000000 000:00000 [ stack ] 00007fff43198000 4 r-x-- 0000000000000000 000:00000 [ anon ] ffffffffff600000 4 r-x-- 0000000000000000 000:00000 [ anon ] mapped: 222472K writeable/private: 122660K shared: 28K Can you reproduce this with the latest release or from git? Thanks. Might be good to try to get some valgrind info too. (In reply to comment #2) > Can you reproduce this with the latest release or from git? Thanks. Might be > good to try to get some valgrind info too. eek, a bit beyond me! I don't suppose there is a deb anywhere that I can use on Ubuntu 0910 64bit? Compiling from source is only going to get me in trouble! Hello?? I have downloaded the latest source, but can't even work out how to compile it and there are no instructions. Doesn't seem to be the usual ./configure ,,, make ... make install process.... seriously, I need help here! After only 1 day and 6 hours uptime: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 959 root 20 0 405m 291m 1864 S 13 14.5 82:21.37 console-kit-dae 18974 colin 20 0 751m 148m 13m S 1 7.4 16:25.05 firefox 2242 root 20 0 199m 141m 2160 S 1 7.0 7:33.82 polkitd 27313 colin 20 0 784m 121m 14m S 0 6.1 2:08.98 cairo-dock 16807 root 20 0 290m 113m 12m S 3 5.6 26:06.31 Xorg 17198 colin 20 0 359m 86m 5608 S 0 4.3 2:55.99 polkit-gnome-au Console-kit-daemon, polkitd and polkit-gnome-authentication-agent-1 are consuming over 0.5GB between them! I would love to try the latest version, but simply can't work out how to compile it, what compilation tools I need, and what other dependencies there are... please can you help, as this is crippling my machine daily. Forget it.... its perfectly clear from all your other tickets that this is your modus operandi, its a shame such a great project has such an unresponsive, discourtious dev involved. I'm running Ubuntu 9.10 x64 with consolekit 0.3.1-0ubuntu2. This workstation has been setting idle fresh from a reboot without logging in for the past two days, and I appear to be suffering from the same issue as this bug report describes. 18:21:05 up 2 days, 2:54, 4 users, load average: 1.07, 1.52, 1.75 Mem: 2056992k total, 1989884k used, 67108k free, 94448k buffers Swap: 6024332k total, 78180k used, 5946152k free, 300644k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1192 root 20 0 753m 558m 1932 S 10 27.8 248:28.92 console-kit-dae My pmap looks very similar, only larger numbers. I am familiar with valgrind, but I haven't dug into how consolekit works. If someone could give me some quick guidance on how to profile consolekit. I'll have 20 or 30 minutes tomorrow evening to try to dig into why this is happening. At least one memory leak is easy to reproduce by running a loop like ssh-copy-id localhost while true; do ssh localhost true; done and watching console-kit-daemon’s resident memory usage go up by tens of kilobytes per second in `top`. (I’m running consolekit 0.4.1-4 on Ubuntu maverick amd64.) Created attachment 37533 [details] [review] patches for a few bad memory leaks These three patches fix most of the really bad (per-session) memory leaks I found with valgrind. (Apply with `git am`.) There is still one worrisome leak within dbus-glib that might or might not be ConsoleKit’s fault: ==4766== 2,400 bytes in 150 blocks are definitely lost in loss record 997 of 1,005 ==4766== at 0x4C284A8: malloc (vg_replace_malloc.c:236) ==4766== by 0x6282514: g_malloc (gmem.c:134) ==4766== by 0x6297749: g_slice_alloc (gslice.c:836) ==4766== by 0x6298F62: g_slist_append (gslist.c:229) ==4766== by 0x4E394C1: dbus_g_connection_register_g_object (dbus-gobject.c:2373) ==4766== by 0x40F127: register_session (ck-session.c:147) ==4766== by 0x40F577: ck_session_new_with_parameters (ck-session.c:1249) ==4766== by 0x408FC7: collect_parameters_cb (ck-manager.c:1621) ==4766== by 0x40DF4F: job_completed (ck-session-leader.c:390) ==4766== by 0x59EB69D: g_closure_invoke (gclosure.c:766) ==4766== by 0x5A02DA8: signal_emit_unlocked_R (gsignal.c:3252) ==4766== by 0x5A04525: g_signal_emit_valist (gsignal.c:2983) But at least it’s much smaller than the ones I fixed. Review of attachment 37533 [details] [review]: Thanks for tracking these down! The review tool doesn't cope very well with having two different patches for the same file apparently so I'm not sure this review will look as intended. Apart from the unref issues I mentioned this looks good. ::: src/ck-manager.c @@ +1256,1 @@ } This isn't right. Functions shouldn't generally unref passed in parameters as a side effect. @@ +1273,1 @@ } Also not right for the same reason. @@ +1287,3 @@ log_seat_session_removed_event (manager, seat, ssid); + + g_free (ssid); We don't need to take a new ref here since we already have one in this context. > This isn't right. Functions shouldn't generally unref passed in parameters as
> a side effect.
I’m pretty sure I needed to do it that way, because ck_session_leader_collect_parameters stashes the callback and the leader away in the pending_jobs queue rather than running the callback immediately. With your modified version of my patch that you committed, is there anything to prevent the leader from being freed while the job is still in the queue?
(In reply to comment #11) > your modified version of my patch that you committed, is there anything to > prevent the leader from being freed while the job is still in the queue? The hash table holds a ref. So I don't think it should happen. (In reply to comment #12) > The hash table holds a ref. So I don't think it should happen. But still, what stops the hash table entry from being removed while the job is still in the queue? Quite frankly, the patch look like it makes a whole lot of sense. Meanwhile, users see their servers die or hang because the daemon eats memory like crazy. Please either apply the patch, or find some other way to stop the leak. Thank you. (In reply to comment #14) > Please either apply the patch, or find some other way to stop the leak. William already applied a modified version of my patch for 0.4.2. The leak should already be gone. http://cgit.freedesktop.org/ConsoleKit/commit/?id=7b9212fa6aff55420c58f2cacd0a941762920337 In the discussion that followed, I was just worried that his modifications introduced a potential use-after-free crash, because the JobData created by ck_session_leader_collect_parameters isn’t holding a reference to its leader. If there is no way for a CkSessionLeader to be freed with entries remaining in its pending_jobs queue (previously this was prevented by the missing unref in create_session_for_sender), then that isn’t a concern and this can be closed. Otherwise, perhaps this presentation makes it clearer why the extra ref and unref are okay? --- a/src/ck-session-leader.c +++ b/src/ck-session-leader.c @@ -409,6 +409,7 @@ job_completed (CkJob *job, static void job_data_free (JobData *data) { + g_object_unref (data->leader); g_free (data); } @@ -428,7 +429,7 @@ ck_session_leader_collect_parameters (CkSessionLeader *session_leader, ret = FALSE; data = g_new0 (JobData, 1); - data->leader = session_leader; + data->leader = g_object_ref (session_leader); data->done_cb = done_cb; data->user_data = user_data; data->context = context; (In reply to comment #15) > + g_object_unref (data->leader); > … > - data->leader = session_leader; > + data->leader = g_object_ref (session_leader); William, do you have any comments on this follow-up patch (comment #15)? Or even just a reason that a CkSessionLeader can’t be freed with entries remaining in its pending_jobs queue, and hence the patch wouldn’t be necessary? I see this bug hasn't been worked on for a while. Issue is still present! root@ccs:/home/milz04# pmap -d 1452 1452: /usr/sbin/console-kit-daemon --no-daemon Address Kbytes Mode Offset Device Mapping 08048000 116 r-x-- 0000000000000000 008:00001 console-kit-daemon 08065000 4 r---- 000000000001c000 008:00001 console-kit-daemon 08066000 4 rw--- 000000000001d000 008:00001 console-kit-daemon 08892000 981868 rw--- 0000000000000000 000:00000 [ anon ] b6500000 132 rw--- 0000000000000000 000:00000 [ anon ] b6521000 892 ----- 0000000000000000 000:00000 [ anon ] b663b000 28 r--s- 0000000000000000 008:00001 gconv-modules.cache b6642000 4 ----- 0000000000000000 000:00000 [ anon ] b6643000 10240 rw--- 0000000000000000 000:00000 [ anon ] b7043000 4 ----- 0000000000000000 000:00000 [ anon ] b7044000 64 rw--- 0000000000000000 000:00000 [ anon ] b7054000 4 ----- 0000000000000000 000:00000 [ anon ] b7055000 64 rw--- 0000000000000000 000:00000 [ anon ] b7065000 4 ----- 0000000000000000 000:00000 [ anon ] b7066000 64 rw--- 0000000000000000 000:00000 [ anon ] b7076000 4 ----- 0000000000000000 000:00000 [ anon ] b7077000 64 rw--- 0000000000000000 000:00000 [ anon ] b7087000 4 ----- 0000000000000000 000:00000 [ anon ] b7088000 64 rw--- 0000000000000000 000:00000 [ anon ] b7098000 4 ----- 0000000000000000 000:00000 [ anon ] b7099000 64 rw--- 0000000000000000 000:00000 [ anon ] b70a9000 4 ----- 0000000000000000 000:00000 [ anon ] b70aa000 64 rw--- 0000000000000000 000:00000 [ anon ] b70ba000 4 ----- 0000000000000000 000:00000 [ anon ] b70bb000 64 rw--- 0000000000000000 000:00000 [ anon ] b70cb000 4 ----- 0000000000000000 000:00000 [ anon ] b70cc000 64 rw--- 0000000000000000 000:00000 [ anon ] b70dc000 4 ----- 0000000000000000 000:00000 [ anon ] b70dd000 64 rw--- 0000000000000000 000:00000 [ anon ] b70ed000 4 ----- 0000000000000000 000:00000 [ anon ] b70ee000 64 rw--- 0000000000000000 000:00000 [ anon ] b70fe000 4 ----- 0000000000000000 000:00000 [ anon ] b70ff000 64 rw--- 0000000000000000 000:00000 [ anon ] b710f000 4 ----- 0000000000000000 000:00000 [ anon ] b7110000 64 rw--- 0000000000000000 000:00000 [ anon ] b7120000 4 ----- 0000000000000000 000:00000 [ anon ] b7121000 64 rw--- 0000000000000000 000:00000 [ anon ] b7131000 4 ----- 0000000000000000 000:00000 [ anon ] b7132000 64 rw--- 0000000000000000 000:00000 [ anon ] b7142000 4 ----- 0000000000000000 000:00000 [ anon ] b7143000 64 rw--- 0000000000000000 000:00000 [ anon ] b7153000 4 ----- 0000000000000000 000:00000 [ anon ] b7154000 64 rw--- 0000000000000000 000:00000 [ anon ] b7164000 4 ----- 0000000000000000 000:00000 [ anon ] b7165000 64 rw--- 0000000000000000 000:00000 [ anon ] b7175000 4 ----- 0000000000000000 000:00000 [ anon ] b7176000 64 rw--- 0000000000000000 000:00000 [ anon ] b7186000 4 ----- 0000000000000000 000:00000 [ anon ] b7187000 64 rw--- 0000000000000000 000:00000 [ anon ] b7197000 4 ----- 0000000000000000 000:00000 [ anon ] b7198000 64 rw--- 0000000000000000 000:00000 [ anon ] b71a8000 4 ----- 0000000000000000 000:00000 [ anon ] b71a9000 64 rw--- 0000000000000000 000:00000 [ anon ] b71b9000 4 ----- 0000000000000000 000:00000 [ anon ] b71ba000 64 rw--- 0000000000000000 000:00000 [ anon ] b71ca000 4 ----- 0000000000000000 000:00000 [ anon ] b71cb000 64 rw--- 0000000000000000 000:00000 [ anon ] b71db000 4 ----- 0000000000000000 000:00000 [ anon ] b71dc000 64 rw--- 0000000000000000 000:00000 [ anon ] b71ec000 4 ----- 0000000000000000 000:00000 [ anon ] b71ed000 64 rw--- 0000000000000000 000:00000 [ anon ] b71fd000 4 ----- 0000000000000000 000:00000 [ anon ] b71fe000 64 rw--- 0000000000000000 000:00000 [ anon ] b720e000 4 ----- 0000000000000000 000:00000 [ anon ] b720f000 64 rw--- 0000000000000000 000:00000 [ anon ] b721f000 4 ----- 0000000000000000 000:00000 [ anon ] b7220000 64 rw--- 0000000000000000 000:00000 [ anon ] b7230000 4 ----- 0000000000000000 000:00000 [ anon ] b7231000 64 rw--- 0000000000000000 000:00000 [ anon ] b7241000 4 ----- 0000000000000000 000:00000 [ anon ] b7242000 64 rw--- 0000000000000000 000:00000 [ anon ] b7252000 4 ----- 0000000000000000 000:00000 [ anon ] b7253000 64 rw--- 0000000000000000 000:00000 [ anon ] b7263000 4 ----- 0000000000000000 000:00000 [ anon ] b7264000 64 rw--- 0000000000000000 000:00000 [ anon ] b7274000 4 ----- 0000000000000000 000:00000 [ anon ] b7275000 64 rw--- 0000000000000000 000:00000 [ anon ] b7285000 4 ----- 0000000000000000 000:00000 [ anon ] b7286000 64 rw--- 0000000000000000 000:00000 [ anon ] b7296000 4 ----- 0000000000000000 000:00000 [ anon ] b7297000 64 rw--- 0000000000000000 000:00000 [ anon ] b72a7000 4 ----- 0000000000000000 000:00000 [ anon ] b72a8000 64 rw--- 0000000000000000 000:00000 [ anon ] b72b8000 4 ----- 0000000000000000 000:00000 [ anon ] b72b9000 64 rw--- 0000000000000000 000:00000 [ anon ] b72c9000 4 ----- 0000000000000000 000:00000 [ anon ] b72ca000 64 rw--- 0000000000000000 000:00000 [ anon ] b72da000 4 ----- 0000000000000000 000:00000 [ anon ] b72db000 64 rw--- 0000000000000000 000:00000 [ anon ] b72eb000 4 ----- 0000000000000000 000:00000 [ anon ] b72ec000 64 rw--- 0000000000000000 000:00000 [ anon ] b72fc000 4 ----- 0000000000000000 000:00000 [ anon ] b72fd000 64 rw--- 0000000000000000 000:00000 [ anon ] b730d000 4 ----- 0000000000000000 000:00000 [ anon ] b730e000 64 rw--- 0000000000000000 000:00000 [ anon ] b731e000 4 ----- 0000000000000000 000:00000 [ anon ] b731f000 64 rw--- 0000000000000000 000:00000 [ anon ] b732f000 4 ----- 0000000000000000 000:00000 [ anon ] b7330000 64 rw--- 0000000000000000 000:00000 [ anon ] b7340000 4 ----- 0000000000000000 000:00000 [ anon ] b7341000 64 rw--- 0000000000000000 000:00000 [ anon ] b7351000 4 ----- 0000000000000000 000:00000 [ anon ] b7352000 64 rw--- 0000000000000000 000:00000 [ anon ] b7362000 4 ----- 0000000000000000 000:00000 [ anon ] b7363000 64 rw--- 0000000000000000 000:00000 [ anon ] b7373000 4 ----- 0000000000000000 000:00000 [ anon ] b7374000 64 rw--- 0000000000000000 000:00000 [ anon ] b7384000 4 ----- 0000000000000000 000:00000 [ anon ] b7385000 64 rw--- 0000000000000000 000:00000 [ anon ] b7395000 4 ----- 0000000000000000 000:00000 [ anon ] b7396000 64 rw--- 0000000000000000 000:00000 [ anon ] b73a6000 4 ----- 0000000000000000 000:00000 [ anon ] b73a7000 64 rw--- 0000000000000000 000:00000 [ anon ] b73b7000 4 ----- 0000000000000000 000:00000 [ anon ] b73b8000 64 rw--- 0000000000000000 000:00000 [ anon ] b73c8000 4 ----- 0000000000000000 000:00000 [ anon ] b73c9000 64 rw--- 0000000000000000 000:00000 [ anon ] b73d9000 4 ----- 0000000000000000 000:00000 [ anon ] b73da000 64 rw--- 0000000000000000 000:00000 [ anon ] b73ea000 4 ----- 0000000000000000 000:00000 [ anon ] b73eb000 64 rw--- 0000000000000000 000:00000 [ anon ] b73fb000 4 ----- 0000000000000000 000:00000 [ anon ] b73fc000 64 rw--- 0000000000000000 000:00000 [ anon ] b740c000 4 ----- 0000000000000000 000:00000 [ anon ] b740d000 64 rw--- 0000000000000000 000:00000 [ anon ] b741d000 4 ----- 0000000000000000 000:00000 [ anon ] b741e000 64 rw--- 0000000000000000 000:00000 [ anon ] b742e000 4 ----- 0000000000000000 000:00000 [ anon ] b742f000 64 rw--- 0000000000000000 000:00000 [ anon ] b743f000 4 ----- 0000000000000000 000:00000 [ anon ] b7440000 64 rw--- 0000000000000000 000:00000 [ anon ] b7450000 4 ----- 0000000000000000 000:00000 [ anon ] b7451000 72 rw--- 0000000000000000 000:00000 [ anon ] b7463000 100 r-x-- 0000000000000000 008:00001 libselinux.so.1 b747c000 4 r---- 0000000000018000 008:00001 libselinux.so.1 b747d000 4 rw--- 0000000000019000 008:00001 libselinux.so.1 b747e000 76 r-x-- 0000000000000000 008:00001 libz.so.1.2.3.3 b7491000 4 r---- 0000000000012000 008:00001 libz.so.1.2.3.3 b7492000 4 rw--- 0000000000013000 008:00001 libz.so.1.2.3.3 b7493000 64 r-x-- 0000000000000000 008:00001 libresolv-2.11.1.so b74a3000 4 r---- 0000000000010000 008:00001 libresolv-2.11.1.so b74a4000 4 rw--- 0000000000011000 008:00001 libresolv-2.11.1.so b74a5000 8 rw--- 0000000000000000 000:00000 [ anon ] b74a7000 188 r-x-- 0000000000000000 008:00001 libpcre.so.3.12.1 b74d6000 4 r---- 000000000002e000 008:00001 libpcre.so.3.12.1 b74d7000 4 rw--- 000000000002f000 008:00001 libpcre.so.3.12.1 b74d8000 8 r-x-- 0000000000000000 008:00001 libdl-2.11.1.so b74da000 4 r---- 0000000000001000 008:00001 libdl-2.11.1.so b74db000 4 rw--- 0000000000002000 008:00001 libdl-2.11.1.so b74dc000 4 rw--- 0000000000000000 000:00000 [ anon ] b74dd000 236 r-x-- 0000000000000000 008:00001 libeggdbus-1.so.0.0.0 b7518000 4 ----- 000000000003b000 008:00001 libeggdbus-1.so.0.0.0 b7519000 4 r---- 000000000003b000 008:00001 libeggdbus-1.so.0.0.0 b751a000 4 rw--- 000000000003c000 008:00001 libeggdbus-1.so.0.0.0 b751b000 1356 r-x-- 0000000000000000 008:00001 libc-2.11.1.so b766e000 4 ----- 0000000000153000 008:00001 libc-2.11.1.so b766f000 8 r---- 0000000000153000 008:00001 libc-2.11.1.so b7671000 4 rw--- 0000000000155000 008:00001 libc-2.11.1.so b7672000 12 rw--- 0000000000000000 000:00000 [ anon ] b7675000 800 r-x-- 0000000000000000 008:00001 libglib-2.0.so.0.2400.1 b773d000 4 r---- 00000000000c7000 008:00001 libglib-2.0.so.0.2400.1 b773e000 4 rw--- 00000000000c8000 008:00001 libglib-2.0.so.0.2400.1 b773f000 28 r-x-- 0000000000000000 008:00001 librt-2.11.1.so b7746000 4 r---- 0000000000006000 008:00001 librt-2.11.1.so b7747000 4 rw--- 0000000000007000 008:00001 librt-2.11.1.so b7748000 16 r-x-- 0000000000000000 008:00001 libgthread-2.0.so.0.2400.1 b774c000 4 r---- 0000000000003000 008:00001 libgthread-2.0.so.0.2400.1 b774d000 4 rw--- 0000000000004000 008:00001 libgthread-2.0.so.0.2400.1 b774e000 4 rw--- 0000000000000000 000:00000 [ anon ] b774f000 12 r-x-- 0000000000000000 008:00001 libgmodule-2.0.so.0.2400.1 b7752000 4 r---- 0000000000002000 008:00001 libgmodule-2.0.so.0.2400.1 b7753000 4 rw--- 0000000000003000 008:00001 libgmodule-2.0.so.0.2400.1 b7754000 244 r-x-- 0000000000000000 008:00001 libgobject-2.0.so.0.2400.1 b7791000 4 r---- 000000000003c000 008:00001 libgobject-2.0.so.0.2400.1 b7792000 4 rw--- 000000000003d000 008:00001 libgobject-2.0.so.0.2400.1 b7793000 616 r-x-- 0000000000000000 008:00001 libgio-2.0.so.0.2400.1 b782d000 4 ----- 000000000009a000 008:00001 libgio-2.0.so.0.2400.1 b782e000 4 r---- 000000000009a000 008:00001 libgio-2.0.so.0.2400.1 b782f000 4 rw--- 000000000009b000 008:00001 libgio-2.0.so.0.2400.1 b7830000 4 rw--- 0000000000000000 000:00000 [ anon ] b7831000 116 r-x-- 0000000000000000 008:00001 libpolkit-gobject-1.so.0.0.0 b784e000 4 r---- 000000000001c000 008:00001 libpolkit-gobject-1.so.0.0.0 b784f000 4 rw--- 000000000001d000 008:00001 libpolkit-gobject-1.so.0.0.0 b7850000 84 r-x-- 0000000000000000 008:00001 libpthread-2.11.1.so b7865000 4 r---- 0000000000014000 008:00001 libpthread-2.11.1.so b7866000 4 rw--- 0000000000015000 008:00001 libpthread-2.11.1.so b7867000 12 rw--- 0000000000000000 000:00000 [ anon ] b786a000 220 r-x-- 0000000000000000 008:00001 libdbus-1.so.3.4.0 b78a1000 4 r---- 0000000000036000 008:00001 libdbus-1.so.3.4.0 b78a2000 4 rw--- 0000000000037000 008:00001 libdbus-1.so.3.4.0 b78a3000 116 r-x-- 0000000000000000 008:00001 libdbus-glib-1.so.2.1.0 b78c0000 4 r---- 000000000001c000 008:00001 libdbus-glib-1.so.2.1.0 b78c1000 4 rw--- 000000000001d000 008:00001 libdbus-glib-1.so.2.1.0 b78c8000 12 rw--- 0000000000000000 000:00000 [ anon ] b78cb000 4 r-x-- 0000000000000000 000:00000 [ anon ] b78cc000 108 r-x-- 0000000000000000 008:00001 ld-2.11.1.so b78e7000 4 r---- 000000000001a000 008:00001 ld-2.11.1.so b78e8000 4 rw--- 000000000001b000 008:00001 ld-2.11.1.so bfc46000 84 rw--- 0000000000000000 000:00000 [ stack ] mapped: 1002204K writeable/private: 996432K shared: 28K Let me know if you need any further information to issue a bug-fix. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.