Optimize memory consumption for tor v0.4.8.1 / disable LZMA / crashes

I struggle because tor v0.4.8.1 on Debian trixie seems to consume quite some memory on startup. Few issues/questions:

  • On startup it reports there is a bug connection_edge.c:1086 (see log below). This is new in comparison to v0.4.8.16 (bullseye) which was starting OK with same config without issues.
  • Sometimes tor crashes (see dump below)
  • I wonder if ~380MB for lzma is really necessary? Can lzma be disabled (or configured to use less memory)?

Many thanks in advance!

Oct 30 23:36:00.000 [notice] Bootstrapped 55% (loading_descriptors): Loading relay descriptors
Oct 30 23:36:01.000 [notice] We're low on memory (cell queues total alloc: 3168 buffer total alloc: 1921024, tor compress total alloc: 392064844 (zlib: 1582080, zstd: 0, lzma: 390482636), rendezvous cache total alloc: 0). Killing circuits withover-long queues. (This behavior is controlled by MaxMemInQueues.)
Oct 30 23:36:01.000 [notice] Removed 1535072 bytes by killing 56 circuits; 0 circuits remain alive. Also killed 1 non-linked directory connections. Killed 141 edge connections
Oct 30 23:36:01.000 [warn] connection_edge_about_to_close(): Bug: (Harmless.) Edge connection (marked at ../src/core/or/circuitlist.c:2716) hasn't sent end yet? (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] tor_bug_occurred_(): Bug: ../src/core/or/connection_edge.c:1086: connection_edge_about_to_close: This line should not have been reached. (Future instances of this warning will be silenced.) (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug: Tor 0.4.8.18: Line unexpectedly reached at connection_edge_about_to_close at ../src/core/or/connection_edge.c:1086. Stack trace: (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /usr/bin/tor(log_backtrace_impl+0x57) [0x55b344df3197] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /usr/bin/tor(tor_bug_occurred_+0x16b) [0x55b344dfe2fb] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /usr/bin/tor(connection_ap_about_to_close+0x1d) [0x55b344ea78bd] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /usr/bin/tor(+0x6f65d) [0x55b344d7665d] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /usr/bin/tor(+0x6fd6b) [0x55b344d76d6b] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /lib/x86_64-linux-gnu/libevent-2.1.so.7(+0x21937) [0x7f12c921a937] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /lib/x86_64-linux-gnu/libevent-2.1.so.7(event_base_loop+0x49f) [0x7f12c921b13f] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /usr/bin/tor(do_main_loop+0x101) [0x55b344d78761] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /usr/bin/tor(tor_run_main+0x1e5) [0x55b344d74005] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /usr/bin/tor(tor_main+0x49) [0x55b344d70319] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /usr/bin/tor(main+0x19) [0x55b344d6fef9] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /lib/x86_64-linux-gnu/libc.so.6(+0x29ca8) [0x7f12c8a4fca8] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f12c8a4fd65] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] Bug:     /usr/bin/tor(_start+0x2a) [0x55b344d6ff4a] (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] connection_ap_about_to_close(): Bug: Closing stream (marked at ../src/core/or/circuitlist.c:2716) without sending back a socks reply. (on Tor 0.4.8.18 )
Oct 30 23:36:01.000 [warn] connection_ap_about_to_close(): Bug: Closing stream (marked at ../src/core/or/circuitlist.c:2716) without having set end_reason. (on Tor 0.4.8.18 )

Dump:

           PID: 2277 (tor)
        Signal: 6 (ABRT)
  Command Line: /usr/bin/tor --defaults-torrc /usr/share/tor/tor-service-defaults-torrc -f /etc/tor/torrc --RunAsDaemon 0
    Executable: /usr/bin/tor
       Message: Process 2277 (tor) of user 120 dumped core.
                
                Module libgcc_s.so.1 from deb gcc-14-14.2.0-19.amd64
                Module libzstd.so.1 from deb libzstd-1.5.7+dfsg-1.amd64
                Module libsystemd.so.0 from deb systemd-257.8-1~deb13u1.amd64
                Stack trace of thread 2277:
                #0  0x00007f2413853507 abort (libc.so.6 + 0x28507)
                #1  0x000055d3814a88ce tor_raw_abort_ (/usr/bin/tor + 0xec8ce)
                #2  0x000055d3814a80fa n/a (/usr/bin/tor + 0xec0fa)
                #3  0x00007f241386adf0 n/a (libc.so.6 + 0x3fdf0)
                #4  0x000055d3815433e4 conflux_get_max_seq_sent (/usr/bin/tor + 0x1873e4)
                #5  0x000055d381546b25 conflux_launch_leg (/usr/bin/tor + 0x18ab25)
                #6  0x000055d3815476d8 conflux_predict_new (/usr/bin/tor + 0x18b6d8)
                #7  0x000055d3815333a8 circuit_build_needed_circs (/usr/bin/tor + 0x1773a8)
                #8  0x000055d38142a8a8 n/a (/usr/bin/tor + 0x6e8a8)
                #9  0x000055d381446457 n/a (/usr/bin/tor + 0x8a457)
                #10 0x00007f241408ba4e n/a (libevent-2.1.so.7 + 0x21a4e)
                #11 0x00007f241408c13f event_base_loop (libevent-2.1.so.7 + 0x2213f)
                #12 0x000055d38142d761 do_main_loop (/usr/bin/tor + 0x71761)
                #13 0x000055d381429005 tor_run_main (/usr/bin/tor + 0x6d005)
                #14 0x000055d381425319 tor_main (/usr/bin/tor + 0x69319)
                #15 0x000055d381424ef9 main (/usr/bin/tor + 0x68ef9)
                #16 0x00007f2413854ca8 n/a (libc.so.6 + 0x29ca8)
                #17 0x00007f2413854d65 __libc_start_main (libc.so.6 + 0x29d65)
                #18 0x000055d381424f4a _start (/usr/bin/tor + 0x68f4a)
                
                Stack trace of thread 5379:
                #0  0x00007f2413fbb65b n/a (liblzma.so.5 + 0x1765b)
                #1  0x00007f2413fbabf7 n/a (liblzma.so.5 + 0x16bf7)
                #2  0x00007f2413fbe55d n/a (liblzma.so.5 + 0x1a55d)
                #3  0x00007f2413fbcd1c n/a (liblzma.so.5 + 0x18d1c)
                #4  0x00007f2413fb9fc4 n/a (liblzma.so.5 + 0x15fc4)
                #5  0x00007f2413fa8d33 lzma_code (liblzma.so.5 + 0x4d33)
                #6  0x000055d38148c04b tor_lzma_compress_process (/usr/bin/tor + 0xd004b)
                #7  0x000055d38148b1b8 tor_compress_process (/usr/bin/tor + 0xcf1b8)
                #8  0x000055d38148b414 n/a (/usr/bin/tor + 0xcf414)
                #9  0x000055d38148ba73 tor_compress (/usr/bin/tor + 0xcfa73)
                #10 0x000055d38156a2e7 n/a (/usr/bin/tor + 0x1ae2e7)
                #11 0x000055d38156a915 n/a (/usr/bin/tor + 0x1ae915)
                #12 0x000055d3815f1713 n/a (/usr/bin/tor + 0x235713)
                #13 0x000055d3814c6512 n/a (/usr/bin/tor + 0x10a512)
                #14 0x00007f24138bdb7b n/a (libc.so.6 + 0x92b7b)
                #15 0x00007f241393b7b8 n/a (libc.so.6 + 0x1107b8)
                
                Stack trace of thread 5382:
                #0  0x00007f2413fba84e n/a (liblzma.so.5 + 0x1684e)
                #1  0x00007f2413fbb701 n/a (liblzma.so.5 + 0x17701)
                #2  0x00007f2413fbabf7 n/a (liblzma.so.5 + 0x16bf7)
                #3  0x00007f2413fbe55d n/a (liblzma.so.5 + 0x1a55d)
                #4  0x00007f2413fbcd1c n/a (liblzma.so.5 + 0x18d1c)
                #5  0x00007f2413fb9fc4 n/a (liblzma.so.5 + 0x15fc4)
                #6  0x00007f2413fa8d33 lzma_code (liblzma.so.5 + 0x4d33)
                #7  0x000055d38148c04b tor_lzma_compress_process (/usr/bin/tor + 0xd004b)
                #8  0x000055d38148b1b8 tor_compress_process (/usr/bin/tor + 0xcf1b8)
                #9  0x000055d38148b414 n/a (/usr/bin/tor + 0xcf414)
                #10 0x000055d38148ba73 tor_compress (/usr/bin/tor + 0xcfa73)
                #11 0x000055d38156a2e7 n/a (/usr/bin/tor + 0x1ae2e7)
                #12 0x000055d38156a915 n/a (/usr/bin/tor + 0x1ae915)
                #13 0x000055d3815f1713 n/a (/usr/bin/tor + 0x235713)
                #14 0x000055d3814c6512 n/a (/usr/bin/tor + 0x10a512)
                #15 0x00007f24138bdb7b n/a (libc.so.6 + 0x92b7b)
                #16 0x00007f241393b7b8 n/a (libc.so.6 + 0x1107b8)
                
                Stack trace of thread 5381:
                #0  0x00007f2413fbe038 n/a (liblzma.so.5 + 0x1a038)
                #1  0x00007f2413fbf139 n/a (liblzma.so.5 + 0x1b139)
                #2  0x00007f2413fbcd1c n/a (liblzma.so.5 + 0x18d1c)
                #3  0x00007f2413fb9fc4 n/a (liblzma.so.5 + 0x15fc4)
                #4  0x00007f2413fa8d33 lzma_code (liblzma.so.5 + 0x4d33)
                #5  0x000055d38148c04b tor_lzma_compress_process (/usr/bin/tor + 0xd004b)
                #6  0x000055d38148b1b8 tor_compress_process (/usr/bin/tor + 0xcf1b8)
                #7  0x000055d38148b414 n/a (/usr/bin/tor + 0xcf414)
                #8  0x000055d38148ba73 tor_compress (/usr/bin/tor + 0xcfa73)
                #9  0x000055d38156a2e7 n/a (/usr/bin/tor + 0x1ae2e7)
                #10 0x000055d38156a915 n/a (/usr/bin/tor + 0x1ae915)
                #11 0x000055d3815f1713 n/a (/usr/bin/tor + 0x235713)
                #12 0x000055d3814c6512 n/a (/usr/bin/tor + 0x10a512)
                #13 0x00007f24138bdb7b n/a (libc.so.6 + 0x92b7b)
                #14 0x00007f241393b7b8 n/a (libc.so.6 + 0x1107b8)
                
                Stack trace of thread 5383:
                #0  0x00007f2413fba813 n/a (liblzma.so.5 + 0x16813)
                #1  0x00007f2413fbb701 n/a (liblzma.so.5 + 0x17701)
                #2  0x00007f2413fbabf7 n/a (liblzma.so.5 + 0x16bf7)
                #3  0x00007f2413fbe55d n/a (liblzma.so.5 + 0x1a55d)
                #4  0x00007f2413fbcd1c n/a (liblzma.so.5 + 0x18d1c)
                #5  0x00007f2413fb9fc4 n/a (liblzma.so.5 + 0x15fc4)
                #6  0x00007f2413fa8d33 lzma_code (liblzma.so.5 + 0x4d33)
                #7  0x000055d38148c04b tor_lzma_compress_process (/usr/bin/tor + 0xd004b)
                #8  0x000055d38148b1b8 tor_compress_process (/usr/bin/tor + 0xcf1b8)
                #9  0x000055d38148b414 n/a (/usr/bin/tor + 0xcf414)
                #10 0x000055d38148ba73 tor_compress (/usr/bin/tor + 0xcfa73)
                #11 0x000055d38156a2e7 n/a (/usr/bin/tor + 0x1ae2e7)
                #12 0x000055d38156a915 n/a (/usr/bin/tor + 0x1ae915)
                #13 0x000055d3815f1713 n/a (/usr/bin/tor + 0x235713)
                #14 0x000055d3814c6512 n/a (/usr/bin/tor + 0x10a512)
                #15 0x00007f24138bdb7b n/a (libc.so.6 + 0x92b7b)
                #16 0x00007f241393b7b8 n/a (libc.so.6 + 0x1107b8)
                
                Stack trace of thread 5385:
                #0  0x000055d3814c364e smartlist_add (/usr/bin/tor + 0x10764e)
                #1  0x000055d38161695a consensus_diff_generate (/usr/bin/tor + 0x25a95a)
                #2  0x000055d38156a71c n/a (/usr/bin/tor + 0x1ae71c)
                #3  0x000055d3815f1713 n/a (/usr/bin/tor + 0x235713)
                #4  0x000055d3814c6512 n/a (/usr/bin/tor + 0x10a512)
                #5  0x00007f24138bdb7b n/a (libc.so.6 + 0x92b7b)
                #6  0x00007f241393b7b8 n/a (libc.so.6 + 0x1107b8)
                
                Stack trace of thread 5380:
                #0  0x00007f24138cdb89 malloc (libc.so.6 + 0xa2b89)
                #1  0x000055d3814b3466 tor_malloc_ (/usr/bin/tor + 0xf7466)
                #2  0x000055d381614af5 n/a (/usr/bin/tor + 0x258af5)
                #3  0x000055d3816155a1 n/a (/usr/bin/tor + 0x2595a1)
                #4  0x000055d38161641b consensus_diff_generate (/usr/bin/tor + 0x25a41b)
                #5  0x000055d38156a71c n/a (/usr/bin/tor + 0x1ae71c)
                #6  0x000055d3815f1713 n/a (/usr/bin/tor + 0x235713)
                #7  0x000055d3814c6512 n/a (/usr/bin/tor + 0x10a512)
                #8  0x00007f24138bdb7b n/a (libc.so.6 + 0x92b7b)
                #9  0x00007f241393b7b8 n/a (libc.so.6 + 0x1107b8)
                
                Stack trace of thread 5384:
                #0  0x00007f24141b34ad adler32_z (libz.so.1 + 0x34ad)
                #1  0x00007f24141bd18d inflate (libz.so.1 + 0xd18d)
                #2  0x000055d38148c74e tor_zlib_compress_process (/usr/bin/tor + 0xd074e)
                #3  0x000055d38148b073 tor_compress_process (/usr/bin/tor + 0xcf073)
                #4  0x000055d38148b414 n/a (/usr/bin/tor + 0xcf414)
                #5  0x000055d38148ba21 tor_uncompress (/usr/bin/tor + 0xcfa21)
                #6  0x000055d381569cf4 n/a (/usr/bin/tor + 0x1adcf4)
                #7  0x000055d38156a6c6 n/a (/usr/bin/tor + 0x1ae6c6)
                #8  0x000055d3815f1713 n/a (/usr/bin/tor + 0x235713)
                #9  0x000055d3814c6512 n/a (/usr/bin/tor + 0x10a512)
                #10 0x00007f24138bdb7b n/a (libc.so.6 + 0x92b7b)
                #11 0x00007f241393b7b8 n/a (libc.so.6 + 0x1107b8)
                
                Stack trace of thread 5378:
                #0  0x00007f241398f3cd n/a (libc.so.6 + 0x1643cd)
                #1  0x000055d381614c5d n/a (/usr/bin/tor + 0x258c5d)
                #2  0x000055d381616cac consensus_diff_generate (/usr/bin/tor + 0x25acac)
                #3  0x000055d38156a71c n/a (/usr/bin/tor + 0x1ae71c)
                #4  0x000055d3815f1713 n/a (/usr/bin/tor + 0x235713)
                #5  0x000055d3814c6512 n/a (/usr/bin/tor + 0x10a512)
                #6  0x00007f24138bdb7b n/a (libc.so.6 + 0x92b7b)
                #7  0x00007f241393b7b8 n/a (libc.so.6 + 0x1107b8)