Bug 1837401

Summary: keepalived sends SIGTERM to systemd on restart
Product: Red Hat Enterprise Linux 8 Reporter: Gregory Thiemonge <gthiemon>
Component: keepalivedAssignee: Ryan O'Hara <rohara>
Status: CLOSED ERRATA QA Contact: Brandon Perkins <bperkins>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: cfeist, cluster-maint
Target Milestone: rcKeywords: TestOnly, Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: keepalived-2.1.5-5.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 16:10:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1889440    
Bug Blocks:    

Description Gregory Thiemonge 2020-05-19 12:40:57 UTC
Description of problem:
When using misc_check with misc_timeout, after a failed check, restarting keepalived sends a SIGTERM to systemd (pid 1)

Version-Release number of selected component (if applicable):
keepalived-2.0.10-10.el8.x86_64
8.2

How reproducible:
100%

Steps to Reproduce:
1. Launch keepalived with a config that uses misc_check and misc_timeout:

virtual_server 172.16.0.32 1234 {
    lb_algo rr
    lb_kind NAT
    protocol UDP
    delay_loop 5
    delay_before_retry 5
    retry 3

    real_server 172.16.0.32 1235 {
        weight 1
        uthreshold 100000
        MISC_CHECK {
            misc_path "sleep 3"
            misc_timeout 2
        }
    }
}

Logs:

Tue May 19 08:15:03 2020: Starting Keepalived v2.0.10 (11/12,2018)
Tue May 19 08:15:03 2020: Running on Linux 4.18.0-193.el8.x86_64 #1 SMP Fri Mar 27 14:35:58 UTC 2020 (built for Linux 4.18.0)
Tue May 19 08:15:03 2020: Command line: 'keepalived' '-D' '-l' '-G' '-n' '--pid=keepalived.pid' '-f' 'keepalived.conf'
Tue May 19 08:15:03 2020: Opening file 'keepalived.conf'.
Tue May 19 08:15:03 2020: Starting Healthcheck child process, pid=857707
Tue May 19 08:15:03 2020: Opening file 'keepalived.conf'.
Tue May 19 08:15:03 2020: WARNING - default user 'keepalived_script' for script execution does not exist - please create.
Tue May 19 08:15:03 2020: WARNING - script `sleep` resolved by path search to `/bin/sleep`. Please specify full path.
Tue May 19 08:15:03 2020: SECURITY VIOLATION - check scripts are being executed but script_security not enabled.
Tue May 19 08:15:03 2020: Initializing ipvs
Tue May 19 08:15:03 2020: Gained quorum 1+0=1 <= 1 for VS [172.16.0.32]:udp:1234
Tue May 19 08:15:03 2020: Activating healthchecker for service [172.16.0.32]:udp:1235 for VS [172.16.0.32]:udp:1234


2. Wait for misc_check to fail

Tue May 19 08:15:10 2020: Misc check for [[172.16.0.32]:udp:1235 VS [172.16.0.32]:udp:1234] by [/usr/bin/sleep] timed out.
Tue May 19 08:15:10 2020: Removing service [172.16.0.32]:udp:1235 to VS [172.16.0.32]:udp:1234
Tue May 19 08:15:10 2020: Lost quorum 1-0=1 > 0 for VS [172.16.0.32]:udp:1234


3. Send a TERM signal to keepalived (or systemctl restart)

$ sudo kill -TERM $(cat keepalived.pid)


Actual results:
systemd receives a TERM signal from keepalived and restarts

May 19 08:15:13 undercloud-0.redhat.local systemd[1]: Received SIGTERM from PID 857707 (keepalived).
May 19 08:15:13 undercloud-0.redhat.local systemd[1]: Reexecuting.
May 19 08:15:13 undercloud-0.redhat.local kernel: printk: systemd: 49 output lines suppressed due to ratelimiting
May 19 08:15:13 undercloud-0.redhat.local systemd[1]: systemd 239 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ >
May 19 08:15:13 undercloud-0.redhat.local systemd[1]: Detected virtualization kvm.
May 19 08:15:13 undercloud-0.redhat.local systemd[1]: Detected architecture x86-64.

Note that "systemctl restart" returns an error


Expected results:
keepalived should exit gracefully, systemd shouldn't be affected


Additional info:

https://github.com/acassen/keepalived/pull/1478/commits/2738ee60b394ab859de18d1a4c8e332cc55887ea fixes that issue.

Comment 13 errata-xmlrpc 2021-05-18 16:10:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (keepalived bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1927