extendr / extendr/rextendr

Some panics cause RStudio to crash

Open
#484 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
263
Forks
35
Avg merge
8d 9h
Merged PRs (30d)
2

Description

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.

```rust
/// 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.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the crash from the generated rextendr project's lib.rs, comparing direct panics with panics from std::thread, rayon parallel iterators, and third-party crates. Determine which panic path causes RStudio to exit; done means the reported third-party or parallel-iterator panic no longer crashes RStudio.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, rust
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.