Re: [systemd-devel] is systemd killing dhclient?,

2015-03-12 Thread Ido Barkan
Thanks a lot!

I have chased that for a long time.
As I understand this is a feature and not a bug, IMO this behavior is very 
surprising.
If a process was killed during ExecStartPre I would expect the starting of the 
service unit
to fail (not happen). This is because something obviously went wrong during the 
preparation 
for the service.
Killing the forking process and launching the service is simply a cause for 
bugs and confusion.
For the very least I would expect an info level clear warning.

Thanks again for your help.
Ido

- Original Message -
From: Lennart Poettering lenn...@poettering.net
To: Ido Barkan ibar...@redhat.com
Cc: systemd-devel@lists.freedesktop.org
Sent: Monday, March 9, 2015 7:03:41 PM
Subject: Re: [systemd-devel] is systemd killing dhclient?

On Mon, 09.03.15 09:14, Ido Barkan (ibar...@redhat.com) wrote:

 Hi All,
 
 I am a VDSM developer at Ovirt project.
 
 VDSM is a daemon which is run as a systemd unit and manages a RHEV hypervisor.
 During it's start up, under ExecStartPre the unit runs an initialization 
 script, that calls 
 a part of VDSM in order to configure networking on the host. During the 
 network initialization
 'ifup' is called for interfaces with DHCP defined as their boot protocol. 
 dhclient then runs, 
 assigns an IP address to the interface and  gets killed!

Yes, this is intended behaviour. ExecStartPre= is for running
preparatory code, not for forking off long-running
processes. 

I have now added a note about this the man page, since this wasn't
documented so far.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] is systemd killing dhclient?

2015-03-09 Thread Ido Barkan
Hi All,

I am a VDSM developer at Ovirt project.

VDSM is a daemon which is run as a systemd unit and manages a RHEV hypervisor.
During it's start up, under ExecStartPre the unit runs an initialization 
script, that calls 
a part of VDSM in order to configure networking on the host. During the network 
initialization
'ifup' is called for interfaces with DHCP defined as their boot protocol. 
dhclient then runs, 
assigns an IP address to the interface and  gets killed!

This is 100% reproducible.

I have done the following things to debug it:

1. using strace I discovered that dhclient is killed by SIGKILL
2. I have run systemd in debug mode (kernel parameters: 
systemd.log_level=debug 
systemd.log_target=kmsg log_buf_len=1M)
3. added a dumb 'sleep 54321 ' line to the initialization script: the sleep 
process was also killed.
4. tried to use auditctl to audit the kill system call but failed.

In dmesg I found those lines:
[Mon Mar  9 04:40:08 2015] systemd[1]: Child 3065 (dhclient) died (code=killed, 
status=9/KILL)
[Mon Mar  9 04:40:08 2015] systemd[1]: Child 2700 (sleep) died (code=killed, 
status=9/KILL)
[Mon Mar  9 04:40:08 2015] systemd[1]: Received SIGCHLD from PID 2700 (n/a).

Does this means that systemd is somehow killing those processes?

btw: This does not happen when ifup is run manually

Thanks,
Ido

system info:
-
[root@centos7 ~]# uname -r
3.10.0-123.20.1.el7.x86_64
[root@centos7 ~]# rpm -qa | grep systemd
systemd-libs-208-11.el7_0.6.x86_64
systemd-208-11.el7_0.6.x86_64
systemd-sysv-208-11.el7_0.6.x86_64
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] is systemd killing dhclient?

2015-03-09 Thread Mantas Mikulėnas
On Mon, Mar 9, 2015 at 3:14 PM, Ido Barkan ibar...@redhat.com wrote:

 Hi All,

 I am a VDSM developer at Ovirt project.

 VDSM is a daemon which is run as a systemd unit and manages a RHEV
 hypervisor.
 During it's start up, under ExecStartPre the unit runs an initialization
 script, that calls
 a part of VDSM in order to configure networking on the host. During the
 network initialization
 'ifup' is called for interfaces with DHCP defined as their boot protocol.
 dhclient then runs,
 assigns an IP address to the interface and  gets killed!


ExecStartPre? Yes, if I remember correctly, systemd kills all leftover
ExecStartPre processes before starting the main daemon. (SIGTERM first,
though.)

It's intentional – ExecStartPre isn't the right place for long-running
processes. Isn't there already an ifup.service or ifup@.service that VDSM
could depend on? [Requires=, After=, etc.]

If not, could you write one (e.g. vdsm-ifup) and *then* make VDSM depend on
it?

-- 
Mantas Mikulėnas graw...@gmail.com
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] is systemd killing dhclient?

2015-03-09 Thread Lennart Poettering
On Mon, 09.03.15 09:14, Ido Barkan (ibar...@redhat.com) wrote:

 Hi All,
 
 I am a VDSM developer at Ovirt project.
 
 VDSM is a daemon which is run as a systemd unit and manages a RHEV hypervisor.
 During it's start up, under ExecStartPre the unit runs an initialization 
 script, that calls 
 a part of VDSM in order to configure networking on the host. During the 
 network initialization
 'ifup' is called for interfaces with DHCP defined as their boot protocol. 
 dhclient then runs, 
 assigns an IP address to the interface and  gets killed!

Yes, this is intended behaviour. ExecStartPre= is for running
preparatory code, not for forking off long-running
processes. 

I have now added a note about this the man page, since this wasn't
documented so far.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel