Bug 64566

Summary: journalctl does not terminate, keeps printing in a loop
Product: systemd Reporter: Peter Wu <peter>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: freedesktop, peter
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: used for git bisect run

Description Peter Wu 2013-05-13 22:08:45 UTC
Created attachment 79274 [details]
used for git bisect run

I have recently noticed issues with the use of `journalctl -a` (Arch Linux on Raspberry Pi) and `journalctl --since today` (Arch Linux x86_64). Where the command should stop (on end of log file), it continues printing older entries and repeats that until the journalctl is killed.

I suspect it is related to corrupted logs or to the timestamps, the Raspberry Pi boots with a timestamp in 1970, my laptop's RTC somehow jumped back 7 hours.

results of bisect:
a3e6f050de81a9830e52af09d5d38dad9a356e3b is the first bad commit
commit a3e6f050de81a9830e52af09d5d38dad9a356e3b
Author: Marius Vollmer <marius.vollmer@redhat.com>
Date:   Thu Apr 18 22:34:36 2013 +0200

    journal: when iterating through a file we might lose messages when changing direction.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=63672

:100644 100644 1221b39cd419325010e331d66068c1fd44039816 cd66914b5c6da29db002723e4eb7487f1070b35c M      TODO
:040000 040000 a0196f64399d332d2fd43455f3bc0575146d3806 a0bf7285eddc892d51642be205983bc11f85ac9c M      src

Reverting this commit on master (v204-25-g32821c7) fixes the wrap-around issue.

I prefer not to share the logs in public, if you need them please send me a email. Attached is a quick-n-dirty bisect script which I used to isolate the faulty commit.
Comment 1 Zbigniew Jedrzejewski-Szmek 2013-06-10 14:48:59 UTC
Can you check if http://cgit.freedesktop.org/systemd/systemd/commit/?id=87011c25d9 fixes things for you? Also,
http://cgit.freedesktop.org/systemd/systemd/commit/?id=cbd671772 should fix one the ways that looped journals are produced, but it won't immediately help if you have such journals currently.
Comment 2 Peter Wu 2013-06-10 17:28:23 UTC
Using v204-144-g7699b6e, `time journalctl -a | head -n100000 | wc -l` terminates properly (63294 entries in 2.7 real time).

Thanks for fixing!
Comment 3 Peter Wu 2013-06-10 17:32:10 UTC
Tested v204-138-g8d98da3 too which is still affected by the bug. v204-139-g87011c2 (the commit you pointed to) is no longer affected by the bug.

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.