Bug 2214258

Summary: systemd reports chronyd.service: Supervising process 1117 which is not our child. We'll most likely not notice when it exits.
Product: Red Hat Enterprise Linux 9 Reporter: Jan Pazdziora <jpazdziora>
Component: chronyAssignee: Miroslav Lichvar <mlichvar>
Status: ASSIGNED --- QA Contact: rhel-cs-infra-services-qe <rhel-cs-infra-services-qe>
Severity: low Docs Contact:
Priority: unspecified    
Version: 9.2CC: jpazdziora
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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: 2231078    
Bug Blocks:    

Description Jan Pazdziora 2023-06-12 11:29:45 UTC
Description of problem:

Sometimes, journal has message

  systemd: chronyd.service: Supervising process 1117 which is not our child. We'll most likely not notice when it exits.

in it.

Version-Release number of selected component (if applicable):

chrony-4.3-1.el9.s390x

How reproducible:

Very non-deterministic.

Steps to Reproduce:
1. Have chronyd.service enabled.
2. Boot the system.
3. Check journal for "Supervising process"

Actual results:

chronyd.service: Supervising process 1117 which is not our child. We'll most likely not notice when it exits.

Expected results:

No such message.

Additional info:

Comment 1 Jan Pazdziora 2023-06-12 11:33:15 UTC
I have a reason to believe that this is caused by a race condition in go_daemon (upstream currently at https://git.tuxfamily.org/chrony/chrony.git/tree/main.c#n344).

When the initial process exits before the first forked process exits, the second forked process whose pid got written to pid_file still has ppid that first forked process. So when systemd checks the ppid for the pid found in the /run/chrony/chronyd.pid, it still sees that first forked child, not self.

Comment 2 Jan Pazdziora 2023-06-12 11:34:12 UTC
The same issue on usbguard.service (bug 2042345) got fixed with https://github.com/USBGuard/usbguard/pull/554/files.

Comment 3 Miroslav Lichvar 2023-06-12 13:59:20 UTC
The chronyd grandparent process waits for one end of a pipe to be closed by both the middle process and the grandchild. The middle process doesn't do that explicitly, it's left up to the kernel to close it when the process terminates. It seems that happens before the ppid of the child is changed, which can break the order of termination.

Thanks for the report.

Comment 5 Miroslav Lichvar 2023-08-10 13:56:42 UTC
This issue will be fixed by rebase to chrony-4.4 (bug #2231078).