>From @teds findings: "The Upstart job creates the cgroup as it goes through each phase in the job, but it sets the cgroup to be destroyed when all of its PIDs are gone. When starting the second or later task (what ever that might be, seems to be post-stop a lot though) there is then a race between starting that task and the cgroup being destroyed if all of the PIDs in the group have exited with the main job. On entering the function to create the task the group is created, and if right then cgmanager realizes the PIDs are gone it deletes it before the new PID can be added."
The solution is to not mark created cgroups 'remove-on-empty' immediately after they are created, but instead to request cgmanager mops up the cgroups after the last job processes cgroups have been created. Note that this approach works correctly for system jobs which specify the cgroup stanza. However, it is not currently reliable for session jobs since because logind does not clean up cgroups itself, systemd-shim arranges for this to happen on behalf of the users session by marking the logind-created cgroups 'remove-on-empty' and letting cgmanager clean up.... which brings us back to the problem which the upstart changes are designed to fix. So, further works is required to resolve this problem by enhancing systemd-shim to implement 'abandoncgroup' and 'stopsession' so that logind works as expected. -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to systemd-shim in Ubuntu. https://bugs.launchpad.net/bugs/1357252 Title: upstart can race with cgmanager when using remove-on-empty Status in Ubuntu Application Launcher: Invalid Status in Upstart: In Progress Status in “cgmanager” package in Ubuntu: Fix Released Status in “systemd-shim” package in Ubuntu: Invalid Bug description: After the ubuntu-app-launch landing in #188 (http://people.canonical.com/~ogra/touch-image-stats/188.changes), UI Toolkit autopilot tests have started failing, see http://ci.ubuntu.com/smokeng/utopic/touch/mako/190:20140815:20140811.1/9676/ubuntuuitoolkit/ and the #188 results too. It's different tests each time, but a bit above 10 of them tend to fail on each full run. Reproducable locally, where I got 11 such failures. To reproduce: [terminal 1] 1. flash/update device if needed 2. adb shell 3. apt install ubuntu-ui-toolkit-autopilot 4. powerd-cli display on bright # leave running, also unlock the screen so that lenses are shown [terminal 2] 5. phablet-config autopilot --dbus-probe enable # wait until finishes 6. phablet-test-run ubuntuuitoolkit A full test suite run will take around 0.5h and should produce a bunch of 'Application failed to start.':s. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu-app-launch/+bug/1357252/+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