From nobody Mon Dec 26 22:08:30 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NgsPB5Hjyz1J6px for ; Mon, 26 Dec 2022 22:08:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NgsPB3Glqz4Gxb for ; Mon, 26 Dec 2022 22:08:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672092510; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h8AiGJWzYY/7QGTV/x8rfwueB668HYAWfRmJ4qPSaek=; b=o6UzujHRk11PFRpSGbzfKxaDX3ttfTL+3FU1JjqbHgP2JZyT4edl/m5oEuB6Vb4TVLxtkQ CFmBUu3xvWWHoqaE8VLv6HCMCrP2SD+IEn9FJQYx56a6YFuuH2nt2Tph3QasXKRdBbUHPj 29GOg57Mb+wyMECJdWRkiW7+eaF/9agl2Cu33yy4+qVXZC9/e+3SEAdyi7HTBNM0mSZApJ RpyYq4a6aydFLMRf+V+oO22WlW+ZuMyI3LSHaRw6KYLTpiJIODGLhEeHH9vGuJdytvyqrm dCVVqDqjCVHLWgJFvlkOZgEX/Uskn0jmomfMFGoGXo+hK9+DQAkZ33ygXt8x1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672092510; a=rsa-sha256; cv=none; b=qkNZNTwpPg6QIyt2qZDTk8YLxHlBVADxb7V/cehzp0aoFoxGaLCMH8BiD6JoBEETxl+azE jkgzOqaHWGE2DGYYBCW4LZkfbIdxgcgpPRSJkn+9I+pNkHHQL3KHyqc6t1rYT6xbsNSbM6 DYfCC6JYwJxu/4pD+OxZYv8g5SbIChdQgtmGfqKRLCjZ6/qJ+AsZscY5WZSGHV9tbJRo9f dTNnjt43CoUvDv/oj5c34QblhhYT3KLcVMOrQ44VooyLFgzvP0jB3B4ZMhel0XWNUKspqK te9+j7g20TLdz4pGZ+rJyazFv57wXe84bmZ3DrnVag13e4o/BoOMgBeZZEik8w== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NgsPB27HSzmWR for ; Mon, 26 Dec 2022 22:08:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 2BQM8USW005884 for ; Mon, 26 Dec 2022 22:08:30 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 2BQM8UUn005883 for bugs@FreeBSD.org; Mon, 26 Dec 2022 22:08:30 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 268580] [PATCH] Add shutdown delay to daemon(8) Date: Mon, 26 Dec 2022 22:08:30 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: nhuff@acm.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268580 Bug ID: 268580 Summary: [PATCH] Add shutdown delay to daemon(8) Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: nhuff@acm.org Created attachment 239046 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D239046&action= =3Dedit Diff to add shutdown_delay to daemon utility Currently if daemon is supervising a process and it receives SIGTERM it sen= ds SIGTERM to the supervised process and then immediately exits. This has a couple potential issues. 1. If the daemon process is writing the stdout/stderr of the process to a l= og file or syslog it can miss messages that are generated after the supervised process receives SIGTERM. 2. If the daemon process is maintaining a PID file for the supervised proce= ss it can get removed before the supervised process actually exits. This can c= ause issues with processes that expect the PID file to be there while the previo= usly supervised process is running. This patch adds a -d option to daemon. If daemon receives SIGTERM it will send SIGTERM to the supervised process and then continue collecting and outputting stdout/stderr. After shutdown_delay seconds if t= he process hasn't already exited it will send SIGKILL to the process and then = wait for it to exit. This will potentially cause the daemon process to hang aro= und indefinitely if the supervised process is wedged somewhere deep in the kern= el with signals blocked, but this way it will properly keep the PID file around while the supervised process is running. --=20 You are receiving this mail because: You are the assignee for the bug.=