Re: 3.18.1: duplicate cf-exexd processes

"vratislav.podzimek via help-cfengine" <[email protected]>
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
On Tue, 2022-03-15 at 13:25 +0100, Marco Marongiu wrote:
> 
> But...
> 
> As you know, systemd is a bit bossy and likes to have everything under its control. This
> unexpected process that pops up and later disappears upsets it a tiny bit, but enough that it
> feels compelled to spew log messages all around about this process that, according to its opinion,
> should not be there.
> 
> But it may not be just about spewing log messages. In fact, I am not sure that systemd is just
> content of "observing" that there is a process that should not be there. If you look at the logs I
> posted, you will see that systemd forces a restart of cf-execd, probably to try and rectify a
> situation that doesn't match systemd's own desired state. On my laptop, cf-execd was restarted
> tens of times in a few hours. Although harmless (or is it?), that's not a desirable behaviour.
> 
> I would suggest that this change also requires some tweaks in the systemd unit files, what do you
> think?
I tried installing and bootstrapping a Debian 11 host with CFEngine 3.18.1 (Enterprise) and I don't
see any problem:

root@ip-172-31-23-195:~# systemctl status cf-execd
● cf-execd.service - CFEngine Execution Scheduler
     Loaded: loaded (/lib/systemd/system/cf-execd.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-03-15 17:42:53 UTC; 26min ago
   Main PID: 931 (cf-execd)
      Tasks: 1 (limit: 17979)
     Memory: 6.6M
        CPU: 7.314s
     CGroup: /system.slice/cf-execd.service
             └─931 /var/cfengine/bin/cf-execd --no-fork

Mar 15 17:42:53 ip-172-31-23-195 systemd[1]: Started CFEngine Execution Scheduler.

root@ip-172-31-23-195:~# journalctl -u cf-execd.service
-- Journal begins at Tue 2022-03-15 17:38:48 UTC, ends at Tue 2022-03-15 18:08:53 UTC. --
Mar 15 17:42:53 ip-172-31-23-195 systemd[1]: Started CFEngine Execution Scheduler.

systemd is actually fine with daemons forking and reaping their child processes. The
cf-execd.service says:

[Service]
Type=simple
ExecStart=/var/cfengine/bin/cf-execd --no-fork
Restart=always
RestartSec=10
KillMode=process

so systemd knows it should care about the /var/cfengine/bin/cf-execd process itself and cf-execd is
told to NOT fork when it starts (i.e. to run in foreground).

What I've seen in your logs was that something else was force-killing cf-execd and then systemd
complained there was a child process left over. That's because cf-execd was force-killed and could
not reap its child process. My bet would be that it was cf-agent killing the cf-execd process
because it was running with a policy saying that there should only be a single cf-execd process
running. With 3.18.1 MPF policy, cf-agent runs expect 1 or 2 cf-execd processes, systemd expects the
main process to be running (and forking) and the service is just running fine (as can be seen
above).

--
Vratislav

-- 
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/7db40191432f71e2ea58b9e77f6717aa7b6d6fa4.camel%40northern.tech.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.