[INTPAK-76] Use Karaf's PID file once we only support Karaf 4 distros Created: 18/Nov/17  Updated: 29/Jun/18

Status: Open
Project: integration-packaging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Medium
Reporter: Daniel Farrell Assignee: Daniel Farrell
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I fielded a question about how we're handling ODL restarts with systemd and which versions of ODL provide a PID file. Short version is that Karaf 4 distros provide a PID file that we may want to point at in our systemd unit file. For now, we're using the default GuessPID behavior and it seems to be working fine. Lots of info from the email exchange below.

This is the systemd unit file we include in upstream (and RH downstream) packages.

https://git.opendaylight.org/gerrit/gitweb?p=integration/packaging.git;a=blob;f=packages/rpm/unitfiles/opendaylight.service;h=ac436592d2880047986b856c7dd6810665ba0d3e;hb=refs/heads/master

Note that we start ODL with `ExecStart=/opt/opendaylight/bin/start` and then expect that process to fork ODL's main process (`Type=forking`).

Note these docs:

> If set to forking, it is expected that the process configured with ExecStart= will call fork() as part of its start-up. The parent process is expected to exit when start-up is complete and all communication channels are set up. The child continues to run as the main daemon process. This is the behavior of traditional UNIX daemons. If this setting is used, it is recommended to also use the PIDFile= option, so that systemd can identify the main process of the daemon.

https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=

Since we're not currently setting a PIDFile, systemd is falling back on guessing the main PID.

See these docs:

> Takes a boolean value that specifies whether systemd should try to guess the main PID of a service if it cannot be determined reliably. This option is ignored unless Type=forking is set and PIDFile= is unset because for the other types or with an explicitly configured PID file, the main PID is always known. The guessing algorithm might come to incorrect conclusions if a daemon consists of more than one process. If the main PID cannot be determined, failure detection and automatic restarting of a service will not work reliably. Defaults to yes.

https://www.freedesktop.org/software/systemd/man/systemd.service.html#GuessMainPID=

I think this PID guessing is working, looking at the main PID info from `sudo systemctl status opendaylight`.

Note that we recently had a discussion about ODL's restart behavior and ended up adding `Restart=on-failure`.

https://git.opendaylight.org/gerrit/#/c/62258/

I see karaf.pid files for these ODL versions.

Nitrogen:

$ sudo dnf install -y http://cbs.centos.org/repos/nfv7-opendaylight-7-release/x86_64/os/Packages/opendaylight-7.0.0-1.el7.noarch.rpm
$ sudo systemctl start opendaylight
$ find /opt/opendaylight -name "*.pid"
/opt/opendaylight/karaf.pid

Oxygen:

$ wget https://nexus.opendaylight.org/content/repositories/opendaylight-oxygen-epel-7-x86_64-devel/org/opendaylight/integration-packaging/opendaylight/8.0.0-0.1.20170928snap597.el7.noarch/opendaylight-8.0.0-0.1.20170928snap597.el7.noarch.rpm
$ sudo rpm -i --nodeps ./opendaylight-8.0.0-0.1.20170928snap597.el7.noarch.rpm
$ sudo systemctl start opendaylight
$ find /opt/opendaylight -name "*.pid"
/opt/opendaylight/karaf.pid

Not with these:

Carbon:

$ sudo dnf install -y http://cbs.centos.org/repos/nfv7-opendaylight-60-release/x86_64/os/Packages/opendaylight-6.0.0-1.el7.noarch.rpm
$ sudo systemctl start opendaylight
$ find /opt/opendaylight -name "*.pid"

  1. nothing

Carbon SR1:

$ sudo dnf install -y http://cbs.centos.org/repos/nfv7-opendaylight-61-release/x86_64/os/Packages/opendaylight-6.1.0-1.el7.noarch.rpm
$ sudo systemctl start opendaylight
$ find /opt/opendaylight -name "*.pid"

  1. nothing

Imported from Trello



 Comments   
Comment by Daniel Farrell [ 29/Jun/18 ]

I haven't looked at this in a long time but during a bug-scrub I noticed that we're now past the trigger that it becomes relevant - we only support Karaf 4 distros. Raising prio and assign to me to figure out what we need to do.

Generated at Wed Feb 07 20:03:32 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.