[systemd-devel] FW: pthread_create() fails SysV in myDaemon on boot

Michael D. Berger m.d.berger at ieee.org
Thu Nov 3 19:11:47 PDT 2011


> -----Original Message-----
> From: 
> systemd-devel-bounces+m.d.berger=ieee.org at lists.freedesktop.or
> g 
> [mailto:systemd-devel-bounces+m.d.berger=ieee.org at lists.freede
sktop.org] On Behalf Of Michael D. Berger
> Sent: Thursday, November 03, 2011 19:27
> To: 'Lennart Poettering'
> Cc: 'Kay Sievers'; systemd-devel at lists.freedesktop.org
> Subject: Re: [systemd-devel] FW: pthread_create() fails SysV 
> in myDaemon on boot
> 
> > -----Original Message-----
> > From: Lennart Poettering [mailto:lennart at poettering.net]
> > Sent: Thursday, November 03, 2011 18:08
> > To: Michael D. Berger
> > Cc: 'Kay Sievers'; systemd-devel at lists.freedesktop.org
> > Subject: Re: [systemd-devel] FW: pthread_create() fails SysV in 
> > myDaemon on boot
> > 
> > On Thu, 03.11.11 15:37, Michael D. Berger 
> (m.d.berger at ieee.org) wrote:
> > 
> > > 
> [...]
> > So, you basically have three options here:
> > 
> > a) Opt out of the "cpu" cgroup controller entirely, by dropping it 
> > from DefaultControllers in /etc/systemd/system.conf.
> > 
> > b) Explicitly place your service in the root cgroup of the "cpu"
> > controller, by adding "ControlGroup=cpu:/" to the service file.
> > 
> > c) By actually assigning an RT budget to the group, by adding 
> > "ControlGroupAttribute=cpu.rt_runtime_us 500000" to the 
> service file.
> > 
[...]
> > 
> > Lennart
> > 
> > --
[...]
> 
> Which service file?  If you mean "myDaemon.service", I don't 
> have one; I have "/etc/init.d/myDaemon".  Could I put options 
> b) or c) in "/etc/init.d/myDaemon"? (I tried it, and I didn't 
> start on boot.  But maybe my format was wrong.)
> 
> In "ControlGroupAttribute" described in any man page?
> 
> Is it necessary for me to create a "myDaemon.service" file?
> If so, in what directory should I put it?
> 
> Note that I also am failing to bind a TCP listener socket.
> 
> Thanks for your help.
> Mike.
> --
[...]

After googing around, here is my first attempt at
/etc/systemd/system/myDaemon.service:

   [Unit]
   Description=myDaemon
   After=syslog.target network.target

   [Service]
   ControlGroupAttribute=cpu.rt_runtime_us 500000
   ExecStart=/usr/sbin/myDaemon --daemon

   [Install]
   WantedBy=multi-user.target

I did a successful "systemctl enable myDaemon.service".
"systemctl start myDaemon.service" starts the program,
but as before, it fails "pthread_create(...)".  Of
course, it also fails on boot.

"/etc/init.d/myDaemon <start|stop>" still work correctly.

Thanks again for your comments.
Mike.



More information about the systemd-devel mailing list