Skip to content

Initializing two workers causes a seg-fault #228

@kdumontnu

Description

@kdumontnu

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:
Running the following script:

use rustyscript::{worker::DefaultWorker, Error, Module};

fn main() -> Result<(), Error> {
    let worker = DefaultWorker::new(Default::default())?;
    let worker2 = DefaultWorker::new(Default::default())?;

    let module = Module::new("test.js", "export function add(a, b) { return a + b; }");
    let module_id = worker.load_module(module)?;

    let result: i32 =
        worker.call_function(Some(module_id), "add".to_string(), vec![1.into(), 2.into()])?;
    println!("{}", result);
    Ok(())
}

Causes a seg fault. I ran into this issue when trying to run on multiple threads (see here)

Desktop (please complete the following information):

  • OS: Linux
  • rustyscript = "0.8.3"

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions