Bug 1096067
Summary: | sd-journal: Undocumented behaviour of sd_journal_send | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Lukas Slebodnik <lslebodn> | ||||
Component: | systemd | Assignee: | systemd-maint | ||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | rawhide | CC: | johannbg, lnykryn, msekleta, plautrba, s, systemd-maint, vpavlin, zbyszek | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2014-07-20 00:00:35 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
systemd-208-18.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/systemd-208-18.fc20 Package systemd-208-18.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing systemd-208-18.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-7512/systemd-208-18.fc20 then log in and leave karma (feedback). Package systemd-208-19.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing systemd-208-19.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-7512/systemd-208-19.fc20 then log in and leave karma (feedback). |
Created attachment 893874 [details] simple program with function sd_journal_send Description of problem: I tried to use some program in docker container, which is able to log messages into the journald and fall back to logging into standard error output. I could not see any log message in journald from this program and there was nothing printed to the stderr. After debugging, I found out that the function sd_journal_sendv silently fails if the journal is not available bash-4.3# cd /usr/src/debug/systemd-212/ bash-4.3# grep -C5 ENOENT src/journal/journal-send.c k = sendmsg(fd, &mh, MSG_NOSIGNAL); if (k >= 0) return 0; /* Fail silently if the journal is not available */ if (errno == ENOENT) return 0; if (errno != EMSGSIZE && errno != ENOBUFS) return -errno; The problem is that the message isn't written into journald and disable possibility logging into files or standard error output. This behaviour limits the recovery and message is lost. *It should be* at least documented in manual page sd_journal_send bash-4.3# man sd_journal_send | grep RETURN -A 8 RETURN VALUE The four calls return 0 on success or a negative errno-style error code. ASYNC SIGNAL SAFETY sd_journal_sendv() is "async signal safe" in the meaning of signal(7). sd_journal_print, sd_journal_printv, sd_journal_send, and sd_journal_perr Version-Release number of selected component (if applicable): bash-4.3# rpm -q systemd-libs systemd-libs-212-4.fc21.x86_64 How reproducible: Deterministic Steps to Reproduce: 1. compile attached file host$ cc `pkg-config --cflags --libs libsystemd-journal` -o jd_simple jd_simple.c 2. run docker container host$ docker run -t -i --rm -v=`pwd`:/example fedora:rawhide /bin/bash 3. ensure journald is not running docker# ls -l /run/systemd/journal/socket ls: cannot access /run/systemd/journal/socket: No such file or directory 4. execute compiled program docker# /example/jd_simple return value from log: [0] host$ journalctl -n 1000 | grep "starting program" host$ echo $? 1 Actual results: The message "starting program" is lost Additional info: The workaround is to mount bind socket from host machine to the docker container host$ docker run -t -i --rm -v=.:/example -v=/run/systemd/journal/:/run/systemd/journal/ fedora /bin/bash