Bug 86855 - Reading journal backwards misses entries
Summary: Reading journal backwards misses entries
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium major
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-29 16:39 UTC by Olivier Brunel (jjacky)
Modified: 2014-12-08 18:24 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Olivier Brunel (jjacky) 2014-11-29 16:39:44 UTC
Simple illustration of the problem:

% coredumpctl list COREDUMP_PID=8212   
TIME                            PID   UID   GID SIG PRESENT EXE
Sat 2014-11-29 13:17:03 CET    8212  1000   100   6 * /usr/bin/Xorg.bin

% coredumpctl list -1 COREDUMP_PID=8212
No match found.


The reason it fails to find a match with -1 is that then sd_journal_seek_tail()/sd_journal_previous() are used, else it's be seek_head()/next(); and apparently going backwards doen't work right.

As a test, I did a small program that uses similar matches (COREDUMP_PID=8212 AND MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1), if the loop with the call to sd_journal_get_data() is done with SD_JOURNAL_FOREACH(j) it works, with SD_JOURNAL_FOREACH_BACKWARDS(j) no matches are found.

Trying using another set of matches (on a COREDUMP_EXE this time), I get 13 matches going forward, only 12 going backwards.

No idea what's going on, but clearly going backwards in the journal doesn't work properly.

This is on up-to-date Arch Linux x86_64:
% systemctl --version
systemd 217
+PAM -AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD +IDN
Comment 1 Lennart Poettering 2014-12-08 18:24:32 UTC
Fixed in git, with your patch! Thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.