Dan, this is the v3 of the patch. I bumped the version to 20.28 since my proposed 20.27 caused the regression aforementioned.
For this version, I removed the dependency of cgmanager, along with the code that added closing sessions to garbage collector. Happens that a similar code is present on systemd-logind already, and for some reason (which is still a mystery for me) I was seeing a session leak in the tool. My hypothesis is that I built one version of the tool without the bunch of debian patches, and so that portion of code wasn't present. Then, I started working in a fix, but in the end, the fix is useless since a similar one is already there. Anyway, the patch now just avoid some small memory leaks in both session's free path and cgmanager glue code. It was tested in both kernels 3.13 and 4.14 (with and without cgmanager), I didn't observe leaks anymore nor high CPU utilization. Thanks, Guilherme ** Patch added: "lp1750013-trusty_v3.debdiff" https://bugs.launchpad.net/ubuntu/artful/+source/systemd/+bug/1750013/+attachment/5100204/+files/lp1750013-trusty_v3.debdiff ** Tags removed: regression-proposed verification-done verification-done-trusty ** Tags added: sts-sru-needed -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to systemd in Ubuntu. https://bugs.launchpad.net/bugs/1750013 Title: systemd-logind: memory leaks on session's connections (trusty-only) Status in systemd package in Ubuntu: Fix Released Status in systemd source package in Trusty: Fix Committed Status in systemd source package in Xenial: Fix Released Status in systemd source package in Artful: Fix Released Status in systemd source package in Bionic: Fix Released Bug description: Below the SRU request form. Please refer to the Original Description to a more comprehensive explanation of the problem observed. [Impact] * systemd-logind tool is leaking memory at each session connected. The issues happens in systemd from Trusty (14.04) only. * Three issues observed: - systemd-logind is leaking entire sessions, i.e, the sessions are not feeed after they're closed. In order to fix that, we proactively add the sessions to systemd garbage collector (gc) when they are closed. Also, part of the fix is to make cgmanager package a dependency. Refer to comment #1 to a more thorough explanation of the issue and the fix. - a small memory leak was observed in the session creation logic of systemd-logind. The fix for that is the addition of an appropriate free() call. Refer to comment #2 to more details on the issue and fix. - another small memory leak was observed in the cgmanager glue code of systemd-logind - this code is only present in this specific Ubuntu release of the package, due to necessary compatibility layer with upstart init system. The fix is to properly call free() in 2 functions. Refer to comment #3 to a deep exposition of the issue and the fix. [Test Case] * The basic test-case is to run the following loop from a remote machine: while true; do ssh <hostname-target> "whoami"; done * It's possible to watch the increase in memory consumption from "systemd-logind" process in the target machine. One can use the "ps uax" command to verify the RSS of the process, or count its anonymous pages from /proc/<logind_pid>/smaps. [Regression Potential] * Since the fixes are small and not intrusive, the potential for regressions are low. More regression considerations on comments #1, #2 and #3 for each fix. * A potential small regressson is performance-wise, since now we add sessions to garbage collector proactively. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1750013/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp