Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Dec 2025 18:40:22 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 291557] syslogd immediately kills process started with pipe
Message-ID:  <bug-291557-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=291557

            Bug ID: 291557
           Summary: syslogd immediately kills process started with pipe
           Product: Base System
           Version: 15.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: work+freebsd@vvv.kiev.ua

Starting from 15.0-RELEASE, syslogd immediately kills process started with pipe
instead of close the pipe and wait for the process exit.

Steps to reproduce:

1. Create script named pipe-test:
--------------------------------------------------
#!/bin/sh
logger -p local3.warning -t pipe-test "$$ START"
while read msg; do
    logger -p local3.warning -t pipe-test "$$ ${msg}"
done
logger -p local3.warning -t pipe-test "$$ END"
exit 0
--------------------------------------------------

2. Add it to configuration of syslogd:
local2.* |exec /home/user/pipe-test

3. Apply new config:
killall -1 syslogd

4. Send message to syslog:
logger -p local2.warning -t logger message1

5. Reread syslogd config to restart pipe-test script:
killall -1 syslogd

6. Send message to syslog again:
logger -p local2.warning -t logger message2

As a result, we got in /var/log/messages:
Dec 10 20:37:24 host logger[77378]: message1
Dec 10 20:37:24 host pipe-test[77383]: 77379 START
Dec 10 20:37:24 host pipe-test[77387]: 77379 Dec 10 20:37:24 host
logger[77378]: message1
Dec 10 20:37:29 host logger[77400]: message2
Dec 10 20:37:29 host pipe-test[77405]: 77401 START
Dec 10 20:37:29 host pipe-test[77409]: 77401 Dec 10 20:37:29 host
logger[77400]: message2

pipe-test script never prints "END" and never reaches exit.

The problem is caused by this commit:

commit d2d180fb77362eb1381ada9edefe4332be776bf2
Author: Jake Freeland <jfree@FreeBSD.org>
Date:   Wed Nov 27 16:26:02 2024 -0600

    syslogd: Watch for dead pipe processes

    For each new pipe process, add its process descriptor into the kqueue
    with the EVFILT_PROCDESC filter and NOTE_EXIT event. When the pipe
    process exits, the main kqueue loop will catch this, logging exit errors
    and cleaning up the pipe process' filed node.

    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D41477

Applying reverse patch and rebuilding syslogd fixes the issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-291557-227>