Re: [exim] socket bind() to port 25 for address (any IPv4) f…

Top Page
Delete this message
Reply to this message
Author: Heiko Schlittermann
Date:  
To: exim-users
Subject: Re: [exim] socket bind() to port 25 for address (any IPv4) failed (#76)
Jeremy Harris via Exim-users <exim-users@???> (So 05 Apr 2020 14:05:01 CEST):
> On 05/04/2020 12:49, Heiko Schlittermann via Exim-users wrote:
> > Maybe we're talking about the same, bot I didn't get your point.
> > That's what I think:
> >
> >     systemd Type=forking
> >     t0  `------ exim -bd
> >                     fork()---- exim daemon
> >     t1   <----------'         - read configuration

>
> Nope.

Ah, yes, you're right.

      systemd Type=forking
      t0  `------ exim -bd
                  - read configuration
                      fork()---- exim daemon
                      exit()     - bind()
      t1   <----------'          - …
      t2                         - listen() // start serving


I just tried it and ran into a timeout during startup. Because with
Type=forking systemd expects the started process to fork. Exim doesn't.
Why? Exim doesn't fork (even in -bd mode), if the PPID == 1. And if systemd
starts Exim, the PPID is 1.

So, your systemd unit is equivalent to

    Type=simple     # this is the default type
    ExecStart=exim -bd <other options>


So, you have access to a non-guessed $MAINPID and could use it in `ExecReload=kill -HUP $MAINPID`
And you can start Exim with -bdf without any further impact, except that
you'd get stdout/stderr to the systemd journal.

But, even if Exim would fork, systemd should notice the startup failure,
because the forking Exim would die early in face of configuration
errors.

> [Type = simple]
> >    - systemd can detect startup failure (if Exim dies on a
> >       configuration file error)

>
> That's a useful point

So, this point doesn't count anymore, as it applies to forking mode to,
if the forking process dies early. But, our Exim doesn't even fork in
forking mode, as it tries to be clever and checks for the PPID and
avoids forking if this equals to 1

According to systemd.service the simple type is the preferred one.

--
Heiko