<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - writes to stdout (via journald) result in -EPIPE after systemd-journald.service restart"
href="https://bugs.freedesktop.org/show_bug.cgi?id=84923">84923</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>writes to stdout (via journald) result in -EPIPE after systemd-journald.service restart
</td>
</tr>
<tr>
<th>Product</th>
<td>systemd
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>general
</td>
</tr>
<tr>
<th>Assignee</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>michael+freedesktop@stapelberg.de
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>#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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>