Image rendering / display glitches in kitty terminal
Closed this issue · 8 comments
going back in the manga pages just shows the last opened page and the home now just shows the last loaded image as all of the images and it goes into loading the images multiple times and tries to crash
and the only error in the logfile is a connection lost not related to the issue
Since this is a UI related issue could you please provide some screenshots to better understand what's going on, also what terminal does this happen on?
going back in the manga pages just shows the last opened page and the home now just shows the last loaded image as all of the images and it goes into loading the images multiple times and tries to crash and the only error in the logfile is a connection lost not related to the issue
same for me here are the screenshots and im using kitty
i tried to recreate the error and log the app output using valgrind and seems like a malloc is messing up the page it keeps going in a loop this is where the faulty code starts
==5718== 21,504 bytes in 64 blocks are still reachable in loss record 1,131 of 1,147
==5718== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==5718== by 0x5681E7: <tokio::signal::registry::EventInfo as core::default::Default>::default (in /usr/bin/manga-tui)
==5718== by 0x56CBB4: tokio::signal::unix::<impl tokio::signal::registry::Init for alloc::vec::Vec<tokio::signal::unix::SignalInfo>>::init (in /usr/bin/manga-tui)
==5718== by 0x18158B: std::sys::sync::once::futex::Once::call (in /usr/bin/manga-tui)
==5718== by 0x18192F: tokio::util::once_cell::OnceCell<T>::do_init (in /usr/bin/manga-tui)
==5718== by 0x57E78C: tokio::runtime::signal::Driver::new (in /usr/bin/manga-tui)
==5718== by 0x580B7B: tokio::runtime::driver::Driver::new (in /usr/bin/manga-tui)
==5718== by 0x57117D: tokio::runtime::builder::Builder::build (in /usr/bin/manga-tui)
==5718== by 0x2EAE8D: manga_tui::main (in /usr/bin/manga-tui)
==5718== by 0x231C35: std::sys_common::backtrace::__rust_begin_short_backtrace (in /usr/bin/manga-tui)
==5718== by 0x2D30BB: std::rt::lang_start::{{closure}} (in /usr/bin/manga-tui)
==5718== by 0x6DF9BF: std::rt::lang_start_internal (in /usr/bin/manga-tui)
==5718==
==5718== 22,496 bytes in 148 blocks are still reachable in loss record 1,132 of 1,147
==5718== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==5718== by 0x4AD8B31: CRYPTO_malloc (mem.c:202)
==5718== by 0x4AD8B95: CRYPTO_zalloc (mem.c:222)
==5718== by 0x4AB9CE4: EVP_PKEY_new (p_lib.c:1455)
==5718== by 0x4A798A2: UnknownInlinedFun (keymgmt_lib.c:79)
==5718== by 0x4A798A2: decoder_construct_pkey (decoder_pkey.c:176)
==5718== by 0x4A77EA5: decoder_process (decoder_lib.c:774)
==5718== by 0x4B8E024: der2key_decode.lto_priv.0 (decode_der2key.c:325)
==5718== by 0x4A780FB: decoder_process (decoder_lib.c:1000)
==5718== by 0x4B90FAF: spki2typespki_decode.lto_priv.0 (decode_spki2typespki.c:136)
==5718== by 0x4A780FB: decoder_process (decoder_lib.c:1000)
==5718== by 0x4A783ED: OSSL_DECODER_from_bio (decoder_lib.c:82)
==5718== by 0x4A78710: OSSL_DECODER_from_data (decoder_lib.c:157)
==5718==
==5718== 23,744 bytes in 106 blocks are still reachable in loss record 1,133 of 1,147
==5718== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==5718== by 0x4AD8B31: CRYPTO_malloc (mem.c:202)
==5718== by 0x4AD8B95: CRYPTO_zalloc (mem.c:222)
==5718== by 0x4B1942E: rsa_new_intern.lto_priv.0 (rsa_lib.c:77)
==5718== by 0x4B1AB1D: rsa_cb (rsa_asn1.c:32)
==5718== by 0x49C4415: asn1_item_embed_new (tasn_new.c:126)
==5718== by 0x49C63F8: UnknownInlinedFun (tasn_new.c:52)
==5718== by 0x49C63F8: asn1_item_embed_d2i (tasn_dec.c:366)
==5718== by 0x49C669F: UnknownInlinedFun (tasn_dec.c:118)
==5718== by 0x49C669F: ASN1_item_d2i_ex (tasn_dec.c:144)
==5718== by 0x4B13C8E: rsa_pub_decode.lto_priv.0 (rsa_ameth.c:85)
==5718== by 0x4B6D408: x509_pubkey_decode (x_pubkey.c:440)
==5718== by 0x4B6D5C4: x509_pubkey_ex_d2i_ex (x_pubkey.c:177)
==5718== by 0x49C5B92: asn1_item_embed_d2i (tasn_dec.c:262)
the part that just keeps on going infinitly and just filling memory is this
==5718== 23,744 bytes in 106 blocks are still reachable in loss record 1,133 of 1,147
==5718== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==5718== by 0x4AD8B31: CRYPTO_malloc (mem.c:202)
==5718== by 0x4AD8B95: CRYPTO_zalloc (mem.c:222)
==5718== by 0x4B1942E: rsa_new_intern.lto_priv.0 (rsa_lib.c:77)
==5718== by 0x4B1AB1D: rsa_cb (rsa_asn1.c:32)
==5718== by 0x49C4415: asn1_item_embed_new (tasn_new.c:126)
==5718== by 0x49C63F8: UnknownInlinedFun (tasn_new.c:52)
==5718== by 0x49C63F8: asn1_item_embed_d2i (tasn_dec.c:366)
==5718== by 0x49C669F: UnknownInlinedFun (tasn_dec.c:118)
==5718== by 0x49C669F: ASN1_item_d2i_ex (tasn_dec.c:144)
==5718== by 0x4B13C8E: rsa_pub_decode.lto_priv.0 (rsa_ameth.c:85)
==5718== by 0x4B6D408: x509_pubkey_decode (x_pubkey.c:440)
==5718== by 0x4B6D5C4: x509_pubkey_ex_d2i_ex (x_pubkey.c:177)
==5718== by 0x49C5B92: asn1_item_embed_d2i (tasn_dec.c:262)
I downloaded the latest version of kitty and I have the same bugs / glitches, I'll try to solve this issue but to be honest I don't know what may be causing this
it look like it is a buffer overflow after a bit of digging looks like the intended behavior is this
==3709== 89,920 bytes in 10 blocks are possibly lost in loss record 1,285 of 1,290
==3709== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==3709== by 0x4F806F: tokio::sync::mpsc::chan::channel (in /usr/bin/manga-tui)
==3709== by 0x4D0C77: <core::pin::Pin<P> as core::future::future::Future>::poll (in /usr/bin/manga-tui)
==3709== by 0x4D8530: <futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll (in /usr/bin/manga-tui)
==3709== by 0x493958: <hyper_util::common::lazy::Lazy<F,R> as core::future::future::Future>::poll (in /usr/bin/manga-tui)
==3709== by 0x4E023C: <futures_util::future::select::Select<A,B> as core::future::future::Future>::poll (in /usr/bin/manga-tui)
==3709== by 0x48957A: hyper_util::client::legacy::client::Client<C,B>::send_request::{{closure}} (in /usr/bin/manga-tui)
==3709== by 0x50DD65: <hyper_util::client::legacy::client::ResponseFuture as core::future::future::Future>::poll (in /usr/bin/manga-tui)
==3709== by 0x47D4F3: <reqwest::async_impl::client::PendingRequest as core::future::future::Future>::poll (in /usr/bin/manga-tui)
==3709== by 0x47D3B9: <reqwest::async_impl::client::Pending as core::future::future::Future>::poll (in /usr/bin/manga-tui)
==3709== by 0x2460E9: manga_tui::backend::fetch::MangadexClient::get_cover_for_manga::{{closure}} (in /usr/bin/manga-tui)
==3709== by 0x24D8FD: manga_tui::view::pages::home::Home::search_popular_mangas_cover::{{closure}} (in /usr/bin/manga-tui)
==3709==
==3709== 106,750 bytes in 148 blocks are still reachable in loss record 1,286 of 1,290
==3709== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==3709== by 0x4AD8B31: CRYPTO_malloc (mem.c:202)
==3709== by 0x49C6186: UnknownInlinedFun (tasn_utl.c:175)
==3709== by 0x49C6186: asn1_item_embed_d2i (tasn_dec.c:470)
==3709== by 0x49C7C01: asn1_template_noexp_d2i (tasn_dec.c:682)
==3709== by 0x49C5F74: asn1_item_embed_d2i (tasn_dec.c:422)
==3709== by 0x49C669F: UnknownInlinedFun (tasn_dec.c:118)
==3709== by 0x49C669F: ASN1_item_d2i_ex (tasn_dec.c:144)
==3709== by 0x4AFC381: PEM_X509_INFO_read_bio_ex (pem_info.c:168)
==3709== by 0x4B3DE18: UnknownInlinedFun (by_file.c:236)
==3709== by 0x4B3DE18: X509_load_cert_crl_file_ex (by_file.c:221)
==3709== by 0x4B3E013: by_file_ctrl_ex (by_file.c:59)
==3709== by 0x4B5B735: X509_STORE_set_default_paths_ex (x509_d2.c:23)
==3709== by 0x50968C: openssl::ssl::connector::SslConnector::builder (in /usr/bin/manga-tui)
==3709== by 0x507A35: native_tls::imp::TlsConnector::new (in /usr/bin/manga-tui)
==3709==
==3709== 378,000 bytes in 1 blocks are still reachable in loss record 1,287 of 1,290
==3709== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==3709== by 0x64D859: ratatui::buffer::buffer::Buffer::filled (in /usr/bin/manga-tui)
==3709== by 0x64D7D5: ratatui::buffer::buffer::Buffer::empty (in /usr/bin/manga-tui)
==3709== by 0x2430F7: ratatui::terminal::terminal::Terminal<B>::new (in /usr/bin/manga-tui)
==3709== by 0x282C8F: manga_tui::main::{{closure}} (in /usr/bin/manga-tui)
==3709== by 0x27A587: tokio::runtime::park::CachedParkThread::block_on (in /usr/bin/manga-tui)
==3709== by 0x2EB0F5: manga_tui::main (in /usr/bin/manga-tui)
==3709== by 0x231C35: std::sys_common::backtrace::__rust_begin_short_backtrace (in /usr/bin/manga-tui)
==3709== by 0x2D30BB: std::rt::lang_start::{{closure}} (in /usr/bin/manga-tui)
==3709== by 0x6DF9BF: std::rt::lang_start_internal (in /usr/bin/manga-tui)
==3709== by 0x2EB373: main (in /usr/bin/manga-tui)
but it seems that the code for the crypto malloc is doing a buffer overflow sometimes like this part
==5718== 23,744 bytes in 106 blocks are still reachable in loss record 1,133 of 1,147
==5718== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==5718== by 0x4AD8B31: CRYPTO_malloc (mem.c:202)
==5718== by 0x4AD8B95: CRYPTO_zalloc (mem.c:222)
==5718== by 0x4B1942E: rsa_new_intern.lto_priv.0 (rsa_lib.c:77)
==5718== by 0x4B1AB1D: rsa_cb (rsa_asn1.c:32)
==5718== by 0x49C4415: asn1_item_embed_new (tasn_new.c:126)
==5718== by 0x49C63F8: UnknownInlinedFun (tasn_new.c:52)
==5718== by 0x49C63F8: asn1_item_embed_d2i (tasn_dec.c:366)
==5718== by 0x49C669F: UnknownInlinedFun (tasn_dec.c:118)
==5718== by 0x49C669F: ASN1_item_d2i_ex (tasn_dec.c:144)
==5718== by 0x4B13C8E: rsa_pub_decode.lto_priv.0 (rsa_ameth.c:85)
==5718== by 0x4B6D408: x509_pubkey_decode (x_pubkey.c:440)
==5718== by 0x4B6D5C4: x509_pubkey_ex_d2i_ex (x_pubkey.c:177)
==5718== by 0x49C5B92: asn1_item_embed_d2i (tasn_dec.c:262)
edit: it looks like the issue might be related to the way kitty terminal uses golang transport for http request and it is causing memory leak
Thanks for providing this information after releasing V0.3.0 #14 I'll try see what I can do about this
I've been changing how I handle images in manga-tui and it's looking better, though requires more refactoring and there is like some flickering in the home page
kitty.mp4
if the u leave the app running for a while the flickering gets a lot worse and it seems to cause it to slow down a lot and crash and it uses lot of memory almost 4 gb per time which is definitely not how it should work