Skip to content

Potential deadlock of .join() #159

@CPunisher

Description

@CPunisher
use std::thread;

use napi_derive::napi;

pub fn panic123() {
    panic!("123")
}

#[napi]
pub fn test() {
    println!("{:?}", thread::spawn(|| panic123()).join());
}
  1. The main js thread is waiting for the child thread with .join
  2. Child thread gets panic and throws error in the js side
  3. worker.onerror cannot be executed since the main thread is stuck
    const handleError = function (e: Event | Error): void {

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