Automattic / Automattic/wordpress-rs
Investigate Deadlock Prevention in `WpApiCache::execute()`
- Dominant language
- Rust
- Stars
- 36
- Forks
- 5
- Avg merge
- 17h 30m
- Merged PRs (30d)
- 43
Description
The `WpApiCache::execute()` [function](https://github.com/Automattic/wordpress-rs/blob/8671843e541be240a60d526f2db18b12cbb87147/wp_mobile_cache/src/lib.rs#L289-L335) can deadlock when nested calls are made through cloned cache references. While the docs note this is "unlikely to write accidentally," it's still possible in real scenarios like callback chains or cross-crate usage.
```rust
let cache2 = cache.clone();
cache.execute(|conn| {
cache2.execute(|conn2| { ... }) // ⚠️ Deadlock!
})?;
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Read wp_mobile_cache/src/lib.rs around WpApiCache::execute() (lines 289–335) and reproduce the nested call using cloned cache references shown in the issue. Determine a prevention approach, with done meaning nested execute calls no longer deadlock.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100