[systemd-bugs] [Bug 84923] New: writes to stdout (via journald) result in -EPIPE after systemd-journald.service restart

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Oct 11 16:15:38 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=84923

            Bug ID: 84923
           Summary: writes to stdout (via journald) result in -EPIPE after
                    systemd-journald.service restart
           Product: systemd
           Version: unspecified
          Hardware: Other
                OS: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
          Assignee: systemd-bugs at lists.freedesktop.org
          Reporter: michael+freedesktop at stapelberg.de
        QA Contact: systemd-bugs at lists.freedesktop.org

#82294 is related, but not exactly the same problem (that bug talks about
syslog, I’m talking about just stdout/stderr).

I wrote a very simple little C program:

#include <stdio.h>
#include <unistd.h>

int main() {
        while (1) {
                printf("Still alive (journald bug test).\n");
                fflush(stdout);
                sleep(60);
        }
}

When running this C program with this unit file:

[Unit]
Description=stillalive

[Service]
User=nnweb
ExecStart=/home/secure/stillalive

[Install]
WantedBy=multi-user.target

…I get one log message every minute into the journal.

However, after issuing “systemctl restart systemd-journald.service”, I no
longer get these log messages. In fact, my program receives -EPIPE when
write()ing:

$ strace -f -p 13573 -s 2048
Process 13573 attached
restart_syscall(<... resuming interrupted call ...>) = 0
write(1, "Still alive (journald bug test).\n", 33) = -1 EPIPE (Broken pipe)
--- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=13573, si_uid=1028} ---
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({60, 0}, 0x7fffe2dac3f0)      = 0
write(1, "Still alive (journald bug test).\n", 33) = -1 EPIPE (Broken pipe)
--- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=13573, si_uid=1028} ---
…

Given that this is the default setting, I’m wondering if I’m doing anything
wrong, or whether there perhaps is a problem with the distribution packaging
(using systemd 215 on Debian)? Is systemd-journald.service not supposed to be
restarted ever? (How) are programs supposed to handle SIGPIPE?

Thanks for clarifying.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-bugs/attachments/20141011/ab628080/attachment.html>


More information about the systemd-bugs mailing list