Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 471016 - sys-apps/openrc: handling of processes inside a cgroup is needed
Summary: sys-apps/openrc: handling of processes inside a cgroup is needed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 439098 463784
  Show dependency tree
 
Reported: 2013-05-22 16:19 UTC by Pacho Ramos
Modified: 2013-08-14 06:41 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
xdm (xdm,5.70 KB, text/plain)
2013-05-25 07:19 UTC, Pacho Ramos
Details
xdm script that handles rc_cgroup_cleanup (xdm,5.71 KB, text/plain)
2013-05-25 07:31 UTC, Alexander Vershilov (RETIRED)
Details
xdm (xdm,5.70 KB, text/plain)
2013-05-25 08:20 UTC, Pacho Ramos
Details
rc-cgroup.sh (rc-cgroup.sh,2.92 KB, text/plain)
2013-05-25 13:19 UTC, Pacho Ramos
Details
patch that fixes situation (small.patch,559 bytes, patch)
2013-06-08 05:13 UTC, Alexander Vershilov (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2013-05-22 16:19:28 UTC
As commented in bug 463784, we need a way to handle processes inside a cgroup is needed. In that exact case, we would simply need to add a way to run "kill -- -<pid>" using start-stop-daemon. 

After talking with gdm upstream, they think this needs to be handled by init system:
https://bugzilla.gnome.org/show_bug.cgi?id=700152#c6

Thanks

Reproducible: Always
Comment 1 William Hubbs gentoo-dev 2013-05-24 16:07:52 UTC
I believe we have something in git that will do what you are
requesting. Check commit c98450.
Comment 2 Pacho Ramos gentoo-dev 2013-05-24 17:20:38 UTC
(In reply to comment #1)
> I believe we have something in git that will do what you are
> requesting. Check commit c98450.

Thanks

I have tried to apply the patch to current latest released version but it fails:
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=patch;h=c98450;hp=e4668a5061de4f225d4e9d534ff6212e634e45d2

I could update to "9999" but I am unsure if latest openrc is stable enough (I don't want to not be able to boot my only working systemd just now :S)

Regarding how is this being handled in the commit, I am unsure about how we will be able to call the cleanup part taking care xdm init.d script is used for different DMs, maybe "rc_cgroup_cleanup="NO"" could be set in /etc/INIT.D/xdm when gdm is used :/
Comment 3 Alexander Vershilov (RETIRED) gentoo-dev 2013-05-25 05:21:29 UTC
> Regarding how is this being handled in the commit, I am unsure about how we
> will be able to call the cleanup part taking care xdm init.d script is used
> for different DMs, maybe "rc_cgroup_cleanup="NO"" could be set in
> /etc/INIT.D/xdm when gdm is used :/

to kill all services on stop you should set rc_cgroup_cleanup="YES", because killing all services in cgroup is not default behaviour. 

To fix situation you may add

if [ ${DISPLAYMANAGER} == "gdm" ] ; then
  $rc_group_cleanup = "yes";
fi

it the toplevel of initscript or conf.d file.
Comment 4 Pacho Ramos gentoo-dev 2013-05-25 07:18:46 UTC
It fails with this:
# LC_ALL=C /etc/init.d/xdm restart
xdm                   |/etc/init.d/xdm: line 41: =: command not found
xdm                   | * Stopping gdm ...
xdm                   | * start-stop-daemon: no matching processes found                                                                        [ ok ]
xdm                   |/etc/init.d/xdm: line 41: =: command not found
xdm                   | * Setting up gdm ...
xdm                   | * start-stop-daemon: /usr/sbin/gdm is already running
xdm                   | * ERROR: could not start the Display Manager                                                                            [ ok ]
Comment 5 Pacho Ramos gentoo-dev 2013-05-25 07:19:01 UTC
Created attachment 349114 [details]
xdm

My xdm script
Comment 6 Alexander Vershilov (RETIRED) gentoo-dev 2013-05-25 07:31:23 UTC
Created attachment 349116 [details]
xdm script that handles rc_cgroup_cleanup

sorry I have to much spelling misstakes in my comment.
Attaching correct version:
Comment 7 Pacho Ramos gentoo-dev 2013-05-25 08:20:58 UTC
Created attachment 349122 [details]
xdm

I am using this one that handles cgroup as yours but will needed changes for gdm3 (pid file location, start_stop_daemon options...), but it fails with the following:
# /etc/init.d/xdm start
xdm                   | * Caching service dependencies ... [ ok ]
xdm                   | * Setting up gdm ... [ ok ]
xdm                   | * starting cgroups cleanup ...
xdm                   |/lib64/rc/sh/rc-cgroup.sh: línea 24: = 5789: no se encontró la orden
xdm                   |/lib64/rc/sh/rc-cgroup.sh: línea 24: = 5794: no se encontró la orden
[ ok ]

and the same occurs when stopping, and it still doesn't kill childs :S
Comment 8 Alexander Vershilov (RETIRED) gentoo-dev 2013-05-25 13:15:48 UTC
(In reply to comment #7)
> Created attachment 349122 [details]
> xdm
> 
> I am using this one that handles cgroup as yours but will needed changes for
> gdm3 (pid file location, start_stop_daemon options...), but it fails with
> the following:
> # /etc/init.d/xdm start
> xdm                   | * Caching service dependencies ... [ ok ]
> xdm                   | * Setting up gdm ... [ ok ]
> xdm                   | * starting cgroups cleanup ...
> xdm                   |/lib64/rc/sh/rc-cgroup.sh: línea 24: = 5789: no se
> encontró la orden
> xdm                   |/lib64/rc/sh/rc-cgroup.sh: línea 24: = 5794: no se
> encontró la orden
> [ ok ]
> 
> and the same occurs when stopping, and it still doesn't kill childs :S

can you attach /lib64/rc/sh/rc-cgroup.sh file you are using? It seems that it's not properly patched as I have no such error (at least with xdm).
I can try to use gdm3.
Comment 9 Pacho Ramos gentoo-dev 2013-05-25 13:19:04 UTC
Created attachment 349132 [details]
rc-cgroup.sh

That is the file, I am not patching it, simply running -9999 build from some hours ago
Comment 10 Alexander Vershilov (RETIRED) gentoo-dev 2013-05-25 13:35:43 UTC
(In reply to comment #9)
> Created attachment 349132 [details]
> rc-cgroup.sh
> 
> That is the file, I am not patching it, simply running -9999 build from some
> hours ago

Thanks I've found a bug in cleanup implementation, I'll update this bug when fix will be merged upstream.
Comment 11 Pacho Ramos gentoo-dev 2013-05-25 14:01:18 UTC
Thanks a lot Alexander!
Comment 12 Alexander Vershilov (RETIRED) gentoo-dev 2013-05-26 02:17:08 UTC
(In reply to Pacho Ramos from comment #11)
> Thanks a lot Alexander!

patch was applied upstream. And thanks to William for fixing my patch. You can test it once again.
Comment 13 Pacho Ramos gentoo-dev 2013-05-26 05:31:31 UTC
It works now :D

But I get the following when stopping (even killing processes properly):
# LC_ALL=C /etc/init.d/xdm stop
xdm                   | * Stopping gdm ...  [ ok ]
xdm                   | * starting cgroups cleanup ...
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2078) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2082) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2083) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2084) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2085) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2086) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2090) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2091) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2092) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2093) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2095) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2097) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2098) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2099) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2108) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2118) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2119) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2123) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2125) - No such process
xdm                   |/lib64/rc/sh/rc-cgroup.sh: line 113: kill: (2134) - No such process
 [ ok ]
Comment 14 Pacho Ramos gentoo-dev 2013-06-06 20:05:06 UTC
Maybe some output is not being properly redirected to /dev/null :/ (because processes are properly killed before showing that messages)
Comment 15 Alexander Vershilov (RETIRED) gentoo-dev 2013-06-08 05:13:54 UTC
Created attachment 350372 [details, diff]
patch that fixes situation

this patch fixes situation. Also I've sent it by pull request on github with one other small cgroup patch.
Comment 16 Pacho Ramos gentoo-dev 2013-06-10 08:39:07 UTC
Works fine! Thanks :)

But we need a release of openrc including all this support to let me start working on updated xorg-server ebuilds providing new xdm init.d script for gdm3 (and also bump finally gdm-3 dropping most of ugly (and now broken) hacks we were carrying to make it compatible with old scripts )

Thanks
Comment 17 Alexander Vershilov (RETIRED) gentoo-dev 2013-06-13 15:02:01 UTC
I've added a dependency on openrc-0.12 tracker.
Comment 18 Fabio Erculiani (RETIRED) gentoo-dev 2013-06-30 17:37:21 UTC
I confirm that it works fine.