Skip to content

Some panics cause RStudio to crash #484

Description

@mhovd

As stated in the title, some panics cause RStudio to crash.
I have had a hard time creating a minimal example, as the following code does NOT cause RStudio to crash.
These are placed in the lib.rs of a new R rextendr project.

/// Just panic
/// @export
#[extendr]
fn just_panic() {
    panic!("at the disco");
}

/// Create a panic due to index out of bounds
/// @export
#[extendr]
fn index_out_of_bounds() {
    let vec = vec![10, 20, 30, 40, 50];
    let _value = vec[7]; // This will panic with index out of bounds
    println!("This line should never be reached!");
}

Similar code with panics in spawned threads (either using std::thread or rayon parallell iterators) does not crash.

What does cause our RStudio to crash are panics in third-party crates, where the panic occurs because of an out-of-bounds error in a parallell iterator, hence the example above.

@CGMossa was able to reproduce, and could probably supply a better example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions