Crash when filtering log piped through stdin
lnav version v0.12.2
Describe the bug I have program with extensive (trace) logs - going to stdout I piped lnav - | lnav -t log viewing worked ok, but when I tried to apply simple out filter (just word dht) lnav crashed after hitting Enter on filter text.
Crash logs for two crashes are attached.
When I redirected stdout from program to file and started lnav on that file it works OK - I can add same filter without crash.
To Reproduce Steps to reproduce the behavior:
- program is rust program (rqbit) started with trace debuging
- pipe it to | lnav -t
- add out filter with text dht and hit Enter
**Crash logs ** crash-2024-08-18-08-48-10.147220.log crash-2024-08-18-08-45-24.146656.log
Stdin pipe is not the only cause of problems, lnav crashes also on same logs supplied from file. When file get bigger - like 300M I got crashes when changing filter - this time crashes are bit random,
more crash files crash-2024-08-24-18-57-21.902337.log crash-2024-08-24-19-46-07.903454.log crash-2024-08-24-19-57-29.922533.log
Getting crashes here even without filters:
Same thing here, doing echo hello | lnav crashes in the same way as displayed on the comment above. Reverting to 0.11.2 from 0.12.2 fixed the issue, though I have not tried any other versions in-between.
Is this reproducible outside nixpkgs?
The original bug report was made on Ubuntu, so I'd assume so?
0.12.4 I notice something similar. Unified logging from macOS 14.6.1 I am stripping some fields for screen space/width so maybe it is file type recognition that fails??
I can do anything I want with 2 steps (file of 49k lines): log show --last 5m |awk '{$1=$3=$4=$5="";$2=substr($2,1,12);print $0}' > tmp5m lnav tmp5m
But immediate crash if I pipe it through in one (I think all the data, or most of it, arrives and is shown before the crash): log show --last 5m |awk '{$1=$3=$4=$5="";$2=substr($2,1,12);print $0}' |lnav Admitted the log data would be very slightly different at a different time but the crash was repeatable...
I sent in the log files (it said 13 files sent but also showed a transfer error message?)
Just to get back on a bit more detail. Looking again at the awk processed data: some files (done in 2 steps) offset hugely left & right when there is logged multi-line data. System suggested using :set-text-view-mode raw, which was indeed much better. I also modified awk to only edit lines starting with year field (^202) eg log show --start "2025-02-24 20:23:26" --end "2025-02-24 20:25:26" |awk '/^202/{$1=$3=$4=$5="";$2=substr($2,1,12)};{print $0}' > t1
In this particular case I was able to process in one piped combo command, but still needed to :set-text-view-mode raw
@cw1nte
0.12.4 I notice something similar.
I have found a bug introduced in v0.12.4 that might be the cause of your problem. A fix is available in the top-of-tree. You can try out one of the builds attached to a run of the "bins" workflow:
https://github.com/tstack/lnav/actions/workflows/bins.yml
Going to close, reopen if it is still a problem.