NetBSD Problem Report #60853

From www@netbsd.org  Tue Oct  6 02:21:17 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 5B3AD1A923B
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  6 Oct 2026 02:21:17 +0000 (UTC)
Message-Id: <20261006022116.244921A923C@mollari.NetBSD.org>
Date: Tue,  6 Oct 2026 02:21:16 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: www/fcgiwrap rc.d woes
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>

>Number:         60853
>Category:       pkg
>Synopsis:       www/fcgiwrap rc.d woes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 06 02:25:01 +0000 2026
>Last-Modified:  Tue Oct 06 03:20:02 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 2026Q3
>Organization:
The NetCGI Foundati*** Child exited, stopped, or continued
>Environment:
>Description:

	1. The rc.d script does not run fcgiwrap under a process
	   supervisor, nor does it close stdin/stdout/stderr and detach
	   from the controlling terminal (i.e., doesn't properly
	   daemonize).

	   So if you do `service fcgiwrap start' from an interactive
	   shell then it will still have your terminal open as
	   stdin/stdout/stderr and as its controlling terminal.  If you
	   log out and hang up the terminal, and fcgiwrap tries to
	   write an error message, it will go nowhere and/or crash.

	2. The rc.d script has no way to pass `-c <n>' to run up to <n>
	   CGI process children in parallel, other than perhaps
	   kludgily setting `command="/usr/pkg/bin/fcgiwrap -c <n>"' in
	   /etc/rc.conf.d/fcgiwrap.

	3. fcgiwrap itself has races with the SIGCHLD handler that
	   could lead the `-c <n>' accounting to go wrong if SIGCHLD
	   arrives at the wrong time.

>How-To-Repeat:

	1. wonder why (a) fcgiwrap randomly exited with no evidence,
	   (b) fcgiwrap has my old tmux session as its ctty
	2. examine ps -d and wonder why fcgiwrap has only one child
	3. code inspection

>Fix:

	Yes, please!

>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60853 CVS commit: pkgsrc/www/fcgiwrap
Date: Tue, 6 Oct 2026 03:15:01 +0000

 Module Name:	pkgsrc
 Committed By:	riastradh
 Date:		Tue Oct  6 03:15:01 UTC 2026

 Modified Files:
 	pkgsrc/www/fcgiwrap: Makefile distinfo
 	pkgsrc/www/fcgiwrap/files: fcgiwrap.sh
 	pkgsrc/www/fcgiwrap/patches: patch-fcgiwrap.c

 Log Message:
 www/fcgiwrap: Fix various issues with multiple children and rc.d.

 - With `-c <n>', don't start spinning the CPU at 100% from the time
   the first child exits to the time the operator gives up and kills
   fcgiwrap altogether.

 - Fix races with SIGCHLD handler.

 - Allow rc.d script to spawn multiple children with new
   `fcgiwrap_nchildren' option (default 1).

 - Redirect stdin from /dev/null, at least, in rc.d script, in lieu of
   either
   (a) proper daemonization and syslogging or
   (b) running under a process supervisor.

 PR pkg/60853: www/fcgiwrap rc.d woes


 To generate a diff of this commit:
 cvs rdiff -u -r1.5 -r1.6 pkgsrc/www/fcgiwrap/Makefile \
     pkgsrc/www/fcgiwrap/distinfo
 cvs rdiff -u -r1.3 -r1.4 pkgsrc/www/fcgiwrap/files/fcgiwrap.sh
 cvs rdiff -u -r1.1 -r1.2 pkgsrc/www/fcgiwrap/patches/patch-fcgiwrap.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.