Skip to content

Deadlock in with_exclusive() #308

@ludfjig

Description

@ludfjig

Repro: The number of iteration varies somewhat, 10_000 seems to consistently repro it though (on my machine)

fn main() -> hyperlight_host::Result<()> {
    // Create an uninitialized sandbox with a guest binary
    let u_sbox = UninitializedSandbox::new(
        hyperlight_host::GuestBinary::FilePath(
            hyperlight_testing::simple_guest_as_string().expect("Guest Binary Missing"),
        ),
        None,
        None,
        None,
    )
    .unwrap();
    let mut mu_sbox: MultiUseSandbox = u_sbox.evolve(Noop::default()).unwrap();

    for i in 0..10000 {
        let res = mu_sbox.call_guest_function_by_name(
            "PrintOutput",
            ReturnType::Int,
            Some(vec![ParameterValue::String(format!("Hello World {}", i))]),
        );
        match res {
            Ok(ReturnValue::Int(len)) => assert!(len >= 0),
            _ => panic!("Unexpected return value: {:?}", res),
        }
    }

    Ok(())
}

Unexpected return value: Err(Error("Error locking at src/hyperlight_host/src/mem/shared_mem.rs:1002: try_lock failed because the operation would block")). Happens both in release and dev profile

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions