awslabs / awslabs/shuttle

Expose a lock which doesn't get poisoned on panic

Open
#237 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.1k
Forks
59
Avg merge
4d 2h
Merged PRs (30d)
15

Description

We need this to fix the `parking_lot` primitives.

Currently they can panic due to the backing primitive becoming poisoned.

My initial thought was to use `clear_poison` https://github.com/awslabs/shuttle/pull/233, but this is not robust, as the following scheme

```
lock.clear_poison();
lock.lock().unwrap();
```
Runs into the issue that the lock holder may panic after the poison has been cleared, and a scheme of the sort:

```
match lock.lock() {
Ok(v) => v,
Err(_e) => {
lock.clear_poison();
self.lock()
}
}
```
Runs into the issue of a single lock becoming multiple yield points.

Either the shuttle-parking_lot primitives have to be built upon something else, or Shuttle has to provide a lock acquire without a scheduling point, or offer locking primitives which don't panic.

An alternative here is to not back Shuttle `Mutex`/`RwLock` on std `Mutex`/`RwLock` (or to provide a way to back them on something else), thought currently doing it like this gives us poison modeling which is convenient.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the shuttle-parking_lot primitives and the Shuttle Mutex/RwLock entry points, then compare their reliance on std Mutex/RwLock poisoning. Review the documented clear_poison and lock-retry approaches, including the linked pull request, and determine which design avoids both panic-on-acquire and multiple scheduling points. Done means the required primitives can acquire locks without the described poisoning failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.