Mithronn / rusty_ytdl

A Rust library for Youtube video searcher and downloader
https://docs.rs/rusty_ytdl
MIT License
107 stars 21 forks source link

Segfault when running multiple times `let info = video.get_info().await?;` in a row, in a tokio task #9

Closed ccgauche closed 11 months ago

ccgauche commented 1 year ago

Here is a minimal reproducible example:

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    tokio::spawn(async move {
            let video_options = VideoOptions::default();
            let video = Video::new_with_options("3OAwbY-rKRw", video_options).unwrap();
            let _ = video.get_info().await.unwrap();
            let _ = video.get_info().await.unwrap();
            let _ = video.get_info().await.unwrap();
            println!("ok");

    }).await.unwrap();
    Ok(())
}
nick42d commented 1 year ago

@ccgauche love your work on Ytermusic! I am working on a similar project and have run into the same error and so may have some useful information:

  1. Error occurred for me on Pop_os! but not EndeavourOS
  2. Core dump on Pop_os! produces the below trace back to v8 source.

`Program terminated with signal SIGSEGV, Segmentation fault.

0 0x0000556c0810aab3 in v8::internal::ThreadIsolation::UnregisterJitPage(unsigned long, unsigned long, --Type for more, q to quit, c to continue without paging--

v8::internal::ThreadIsolation::AllocationSource) () at ../../../../v8/src/common/code-memory-access.cc:364 364 ../../../../v8/src/common/code-memory-access.cc: No such file or directory. [Current thread is 1 (Thread 0x7ff36c7f4640 (LWP 40954))]`

ccgauche commented 1 year ago

I managed to fix the issue I'll make a PR you can always use my fork that fixes the issue

Mithronn commented 1 year ago

@ccgauche i saw your fork and boa_engine is more stable than js-sandbox! I will implement with the new release 0.6.5! Thanks for the fork.