Bug#934513: Please fix service to daemonize properly

Michael Biebl biebl at debian.org
Sun Aug 11 21:00:28 BST 2019


Package: coturn
Version: 4.5.1.1-1.1
Severity: normal

Hi,

I noticed that your coturn.service contains:

Type=forking
RuntimeDirectory=turnserver
PIDFile=/run/turnserver/turnserver.pid
ExecStart=/usr/bin/turnserver --daemon -c /etc/turnserver.conf --pidfile /run/turnserver/turnserver.pid
#FixMe: turnserver exit faster than it is finshing the setup and ready for handling the connection.
ExecStartPost=/bin/sleep 2

Emphasis on the "sleep 2".

Please don't do that.
Instead, make sure that your service daemonizes properly if it uses
Type=forking, i.e. the parent process should only exit once the child
process is ready to access connections.
See man 7 daemon

The (better) alternative would be if your service would support the
sd_notify API. Then the daemon can signal systemd in a race-free way
once it is ready to process connections.
Adding sd_notify is rather simple.

See man sd_notify

Thanks for considering,
Michael


-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages coturn depends on:
ii  adduser                  3.118
ii  libc6                    2.28-10
pn  libevent-core-2.1-6      <none>
pn  libevent-extra-2.1-6     <none>
pn  libevent-openssl-2.1-6   <none>
pn  libevent-pthreads-2.1-6  <none>
ii  libhiredis0.14           0.14.0-3
ii  libmariadb3              1:10.3.17-1
ii  libpq5                   11.5-1
ii  libsqlite3-0             3.29.0-1
ii  libssl1.1                1.1.1c-1
ii  lsb-base                 10.2019051400
pn  sqlite3                  <none>
ii  telnet [telnet-client]   0.17-41.2

coturn recommends no packages.

Versions of packages coturn suggests:
pn  sip-router   <none>
pn  xmpp-server  <none>



More information about the Pkg-voip-maintainers mailing list