[systemd-bugs] [Bug 81019] if unit's process exits non-zero no more logging for that unit until reboot

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Aug 20 04:53:15 PDT 2014


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

--- Comment #2 from Piotr Staszewski <p.staszewski at gmail.com> ---
I did some more testing today, and my results are weird, but I suspect it's due
to my peculiar setup.
I have /var/log as a tmpfs ('tmpfs /var/log tmpfs
defaults,noatime,nodiratime,mode=0755,size=16M 0 0').

0. Testing software
Simple printf() loop, binary at /home/user/test-logging:

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

int main(int argc, char *argv[]) {
  int counter = 0;

  while (1) {
    printf("<5>Counter: %d\n", counter);
    fflush(stdout);
    sleep(3);
    counter++;
  }
}

Service file, saved at /etc/systemd/system/test-logging.service:

[Unit]
Description=Logging tester
After=network.target

[Service]
ExecStart=/home/user/test-logging
WorkingDirectory=/home/user
Restart=always

[Install]
WantedBy=multi-user.target

1. Test one
Systemd and journald have been running since boot, where journald.conf has:

[Journal]
Storage=persistent
SyncIntervalSec=30m
SystemMaxUse=8M

At shell:
systemctl start test-logging
systemctl status test-logging - did it a couple of times, no counter output
logged whatsoever
systemctl stop test-logging

2. Test two
Modified journald.conf to have only:

[Journal]
SystemMaxUse=8M

At shell:
systemctl restart systemd-journald
systemctl start test-logging
systemctl status test-logging - did it a couple of times, counter output is
being logged as intended
systemctl restart test-logging
systemctl status test-logging - still logging as it should
systemctl stop test-logging

3. Test three
So I added back my two custom options to journald.conf:

[Journal]
Storage=persistent
SyncIntervalSec=30m
SystemMaxUse=8M

At shell:
systemctl restart systemd-journald
systemctl start test-logging
systemctl status test-logging - did it a couple of times, logging well as in
the previous test!
systemctl stop test-logging


In a way my problem seems to be solved, though I do not understand exactly why
the logging works as the above tests show. My guess is that the tmpfs /var/log
with Storage=persistent causes some trouble on boot and systemd is not logging;
then restarting it without the Storage options invokes some setup code, so that
from that point the logging works regardless of Storage or SyncIntervalSec
values...

Please feel free to close this issue if the above behaviour is a known
condition/intended feature etc.

-- 
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/20140820/0457c49e/attachment.html>


More information about the systemd-bugs mailing list