lnav icon indicating copy to clipboard operation
lnav copied to clipboard

lnav crashes on FreeBSD 14.1

Open rooty0 opened this issue 1 year ago • 4 comments

lnav version v0.12.2 crash-2024-10-04-09-12-33.11785.log

Describe the bug Just installed lnav and it crashes right away when I try to open a log file. Not 100% if that's related to the OS. Attaching the crash log.

To Reproduce run like lnav /var/log/auth.log or any file

rooty0 avatar Oct 04 '24 06:10 rooty0

fyi, I've just downgraded to version 0.11.2 and it works just fine. The following versions are broken for me:

  • lnav-0.12.2
  • lnav-0.12.1

Looks like something is broken in lnav-0.12.1

rooty0 avatar Oct 04 '24 23:10 rooty0

Not sure if this is the same issue but I also experience crash on FreeBSD 14.1 though in my case /var/log/auth.log works fine but crashes on most other logs, for example /var/log/maillog

I isolated it to this:

Oct 11 00:00:00 chinatsu newsyslog[13584]: logfile turned over
Oct 11 00:00:11 chinatsu sm-mta[13599]: NOQUEUE: connect from [83.222.190.50]

The first line is parsed correctly, but the 2nd if present crashes lnav. Attaching log, I also get some extra information from gdb:

(gdb) bt
#0  _wait4 () at _wait4.S:4
#1  0x0000000829aa7aec in __thr_wait4 (pid=-1, status=0x379c0a9fedd8, options=0, rusage=0x0) at /usr/src/lib/libthr/thread/thr_syscalls.c:578
#2  0x000000000185e92c in sigabrt (sig=4, info=0x379c0aa00630, ctx=0x379c0aa002c0) at lnav_log.cc:577
#3  0x0000000829aa541f in handle_signal (actp=actp@entry=0x379c0aa00240, sig=sig@entry=4, info=info@entry=0x379c0aa00630, ucp=ucp@entry=0x379c0aa002c0) at /usr/src/lib/libthr/thread/thr_sig.c:298
#4  0x0000000829aa49cb in thr_sighandler (sig=4, info=0x379c0aa00630, _ucp=0x379c0aa002c0) at /usr/src/lib/libthr/thread/thr_sig.c:243
#5  <signal handler called>
#6  0x0000000000e0412d in std::__1::list<data_parser::element, std::__1::allocator<data_parser::element> >::back[abi:se180100]() (this=0x822bc69f0) at /usr/include/c++/v1/list:797
#7  0x0000000001396500 in data_parser::end_of_value (this=0x379c0bd25da0, el_stack=..., key_comps=..., value=..., in_list=..., group_depth=1, iter=...) at data_parser.cc:819
#8  0x0000000001393e6b in data_parser::pairup (this=0x379c0bd25da0, schema=0x0, pairs_out=..., in_list=..., group_depth=1) at data_parser.cc:335
#9  0x0000000001392357 in data_parser::pairup (this=0x379c0bd25da0, schema=0x379c0bd25e40, pairs_out=..., in_list=..., group_depth=0) at data_parser.cc:71
#10 0x0000000001398335 in data_parser::parse (this=0x379c0bd25da0) at data_parser.cc:902
#11 0x00000000010d14f1 in log_data_helper::parse_line (this=0x822bc86a8, line=..., allow_middle=true) at log_data_helper.cc:98
#12 0x0000000000e02eb3 in log_data_helper::parse_line (this=0x822bc86a8, line=..., allow_middle=true) at ./log_data_helper.hh:57
#13 0x00000000010bede5 in lnav::log::annotate::applicable (vl=...) at log.annotate.cc:131
#14 0x0000000000e0056c in field_overlay_source::build_meta_line (this=0x379c09428600, lv=..., dst=std::vector of length 0, row=...) at field_overlay_source.cc:495
#15 0x0000000000e02124 in field_overlay_source::list_value_for_overlay (this=0x379c09428600, lv=..., row=..., value_out=std::vector of length 0) at field_overlay_source.cc:672
#16 0x0000000000f31526 in listview_curses::do_update (this=0x22ead40 <lnav_data+24096>) at listview_curses.cc:502
#17 0x0000000000bb0458 in view_stack<textview_curses>::do_update()::{lambda(textview_curses*)#1}::operator()(textview_curses*) const (this=0x822bc9b88, vc=0x22ead40 <lnav_data+24096>) at ./view_curses.hh:502
#18 0x0000000000bb02ca in _ZorIN6nonstd13optional_lite8optionalIP15textview_cursesEEZN10view_stackIS3_E9do_updateEvEUlS4_E_TnNSt3__19enable_ifIXsr6detail11is_optionalIu7__decayIT_EEE5valueEiE4typeELi0EEDTclsr6detailE15void_or_nulloptIDTclfp0_cldtclsr3stdE7forwardISB_Efp_EonmlEEEEEEOSB_T0_ (t=..., f=...) at ./base/opt_util.hh:72
#19 0x0000000000bb00f4 in view_stack<textview_curses>::do_update (this=0x22eac90 <lnav_data+23920>) at ./view_curses.hh:498
#20 0x0000000000b5481a in looper () at lnav.cc:1635
#21 0x0000000000b4ba7f in main (argc=2, argv=0x822bd22e0) at lnav.cc:3523
(gdb) up 7
#7  0x0000000001396500 in data_parser::end_of_value (this=0x379c0bd25da0, el_stack=..., key_comps=..., value=..., in_list=..., group_depth=1, iter=...) at data_parser.cc:819
819             if (el_stack.back().e_token == DNT_KEY
(gdb) list
814                     }
815                 }
816             } while (key_iter != key_comps.begin() && !found);
817         }
818         if (!mixed_queue.empty()) {
819             if (el_stack.back().e_token == DNT_KEY
820                 && mixed_queue.front().e_token == DNT_KEY)
821             {
822                 el_stack.POP_BACK();
823             }
(gdb) p el_stack
$1 = (data_parser::element_list_t &) @0x822bc69f0: {<std::__1::list<data_parser::element, std::__1::allocator<data_parser::element> >> = empty std::list, el_format = {df_name = 0x0, df_appender = DT_INVALID, df_terminator = DT_INVALID,
    df_qualifier = DT_INVALID, df_separator = DT_COLON, df_prefix_terminator = DT_INVALID}}
(gdb) p el_stack.empty()
$2 = true

It looks like el_stack is empty which makes el_stack.back() crash.

crash-2024-10-11-23-52-11.18397.log

takeda avatar Oct 12 '24 06:10 takeda

I think this is likely the same issue. I just downgraded to 0.11.2 and that version also appears to not crash for me.

takeda avatar Oct 13 '24 04:10 takeda

I can attest to lnav 0.12.2 crashing on 14.1-p5 at least.

krolingo avatar Oct 15 '24 15:10 krolingo

Are you folks install lnav using pkg? I'm trying to replicate with a vagrant VM. The version installed by pkg is blowing up on startup for me after upgrade the VM from 14.0 to 14.1. I'm not seeing any issues when compiling from source.

tstack avatar Oct 22 '24 21:10 tstack

@tstack I do

make -C /usr/ports/sysutils/lnav install clean

sfc-gh-srudenko avatar Oct 22 '24 23:10 sfc-gh-srudenko

@tstack I traditionally compile from sources via ports like @sfc-gh-srudenko, and it was crashing, but I just tested with binary installation via pkg and that's crashing too.

When I revert the latest upgrade (from 0.11.2 to 0.12.2) in ports and compile it, it works fine for me without errors.

takeda avatar Oct 23 '24 00:10 takeda

@tstack, so I did install lnav inside a fresh, clean jail on my FreeBSD (make -C /usr/ports/sysutils/lnav install clean), and I can confirm it's not crashing inside the clean system. Interesting

rooty0 avatar Oct 24 '24 06:10 rooty0

So, FYI, this is the environment where it works

$ ldd /usr/local/bin/lnav
/usr/local/bin/lnav:
        libreadline.so.8 => /usr/local/lib/libreadline.so.8 (0x30a8a56f3000)
        libncursesw.so.9 => /lib/libncursesw.so.9 (0x30a8a68ab000)
        libtinfow.so.9 => /lib/libtinfow.so.9 (0x30a8a61b7000)
        libsqlite3.so.0 => /usr/local/lib/libsqlite3.so.0 (0x30a8a74ab000)
        libarchive.so.7 => /usr/lib/libarchive.so.7 (0x30a8a788d000)
        libcurl.so.4 => /usr/local/lib/libcurl.so.4 (0x30a8a7f95000)
        libpcre2-8.so.0 => /usr/local/lib/libpcre2-8.so.0 (0x30a8a9c10000)
        libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x30a8a8d51000)
        libbz2.so.4 => /usr/lib/libbz2.so.4 (0x30a8aabae000)
        libz.so.6 => /lib/libz.so.6 (0x30a8ab5c7000)
        libutil.so.9 => /lib/libutil.so.9 (0x30a8ac330000)
        libthr.so.3 => /lib/libthr.so.3 (0x30a8accb5000)
        libc++.so.1 => /lib/libc++.so.1 (0x30a8add68000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x30a8ad7bd000)
        libm.so.5 => /lib/libm.so.5 (0x30a8ae095000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x30a8ae555000)
        libc.so.7 => /lib/libc.so.7 (0x30a8b023f000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x30a8aec3a000)
        libbsdxml.so.4 => /lib/libbsdxml.so.4 (0x30a8af525000)
        libprivatezstd.so.5 => /usr/lib/libprivatezstd.so.5 (0x30a8b0791000)
        libcrypto.so.30 => /lib/libcrypto.so.30 (0x30a8b1133000)
        libnghttp2.so.14 => /usr/local/lib/libnghttp2.so.14 (0x30a8b2b2c000)
        libssh2.so.1 => /usr/local/lib/libssh2.so.1 (0x30a8b1aa9000)
        libpsl.so.5 => /usr/local/lib/libpsl.so.5 (0x30a8b2927000)
        libssl.so.30 => /usr/lib/libssl.so.30 (0x30a8b39c2000)
        libheimntlm.so.11 => /usr/lib/libheimntlm.so.11 (0x30a8b4270000)
        libhx509.so.11 => /usr/lib/libhx509.so.11 (0x30a8b44cb000)
        libcom_err.so.5 => /usr/lib/libcom_err.so.5 (0x30a8b4742000)
        libasn1.so.11 => /usr/lib/libasn1.so.11 (0x30a8b4784000)
        libwind.so.11 => /usr/lib/libwind.so.11 (0x30a8b4b1d000)
        libheimbase.so.11 => /usr/lib/libheimbase.so.11 (0x30a8b4b97000)
        libroken.so.11 => /usr/lib/libroken.so.11 (0x30a8b631a000)
        libcrypt.so.5 => /lib/libcrypt.so.5 (0x30a8b51aa000)
        libkrb5.so.11 => /usr/lib/libkrb5.so.11 (0x30a8b60b3000)
        libgssapi.so.10 => /usr/lib/libgssapi.so.10 (0x30a8b7179000)
        libgssapi_krb5.so.10 => /usr/lib/libgssapi_krb5.so.10 (0x30a8b8b6b000)
        libelf.so.2 => /lib/libelf.so.2 (0x30a8b7d57000)
        libmd.so.6 => /lib/libmd.so.6 (0x30a8b9175000)
        libidn2.so.0 => /usr/local/lib/libidn2.so.0 (0x30a8b980d000)
        libunistring.so.5 => /usr/local/lib/libunistring.so.5 (0x30a8ba0fb000)
        libprivateheimipcc.so.11 => /usr/lib/libprivateheimipcc.so.11 (0x30a8bb1ec000)
        [vdso] (0x30a8a5671000)

And this is the environment where it's broken

$  ldd /usr/local/bin/lnav
/usr/local/bin/lnav:
        libreadline.so.8 => /usr/local/lib/libreadline.so.8 (0x271d7c603000)
        libncurses.so.6 => /usr/local/lib/libncurses.so.6 (0x271d7b705000)
        libtinfo.so.6 => /usr/local/lib/libtinfo.so.6 (0x271d7c668000)
        libsqlite3.so.0 => /usr/local/lib/libsqlite3.so.0 (0x271d7d6d9000)
        libarchive.so.13 => /usr/local/lib/libarchive.so.13 (0x271d7e0ff000)
        libcurl.so.4 => /usr/local/lib/libcurl.so.4 (0x271d7e5e3000)
        libpcre2-8.so.0 => /usr/local/lib/libpcre2-8.so.0 (0x271d7e765000)
        libtinfow.so.9 => /lib/libtinfow.so.9 (0x271d7f4da000)
        libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x271d7d011000)
        libbz2.so.4 => /usr/lib/libbz2.so.4 (0x271d7fc80000)
        libz.so.6 => /lib/libz.so.6 (0x271d80d8e000)
        libutil.so.9 => /lib/libutil.so.9 (0x271d80018000)
        libthr.so.3 => /lib/libthr.so.3 (0x271d81fa9000)
        libc++.so.1 => /lib/libc++.so.1 (0x271d81971000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x271d82eac000)
        libm.so.5 => /lib/libm.so.5 (0x271d830e6000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x271d836a1000)
        libc.so.7 => /lib/libc.so.7 (0x271d84805000)
        libcrypto.so.12 => /usr/local/lib/libcrypto.so.12 (0x271d851d7000)
        libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x271d84239000)
        liblzo2.so.2 => /usr/local/lib/liblzo2.so.2 (0x271d85b13000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x271d86b09000)
        libzstd.so.1 => /usr/local/lib/libzstd.so.1 (0x271d86cfa000)
        liblz4.so.1 => /usr/local/lib/liblz4.so.1 (0x271d872eb000)
        libidn2.so.0 => /usr/local/lib/libidn2.so.0 (0x271d877d3000)
        libssl.so.12 => /usr/local/lib/libssl.so.12 (0x271d8817d000)
        libbrotlidec.so.1 => /usr/local/lib/libbrotlidec.so.1 (0x271d88f98000)
        libelf.so.2 => /lib/libelf.so.2 (0x271d89040000)
        libmd.so.6 => /lib/libmd.so.6 (0x271d897b7000)
        libunistring.so.5 => /usr/local/lib/libunistring.so.5 (0x271d8a0b8000)
        libbrotlicommon.so.1 => /usr/local/lib/libbrotlicommon.so.1 (0x271d8b4d7000)
        [vdso] (0x271d7a78c000)

rooty0 avatar Oct 24 '24 07:10 rooty0

Thanks for the report, I made a couple fixes (15361d51ffa5f963f9c8fef0918d4f21957e5f87 and af786bfc22dbc7ef2294a9d6b355b354b382e5af) and I think this should be fixed.

tstack avatar Oct 24 '24 20:10 tstack

I just did the port build with the patches and can confirm it works! Thanks @tstack!

rooty0 avatar Oct 25 '24 18:10 rooty0