Skip to content

Protect r_task() from panics and detect cancelled handlers#1269

Open
lionel- wants to merge 1 commit into
oak/salsa-27-wire-urlfrom
oak/salsa-28-rtask-unwind
Open

Protect r_task() from panics and detect cancelled handlers#1269
lionel- wants to merge 1 commit into
oak/salsa-27-wire-urlfrom
oak/salsa-28-rtask-unwind

Conversation

@lionel-

@lionel- lionel- commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Branched from #1268
Progress towards #1212

Currently a Salsa cancellation panic can't be triggered in an r_task() because all calls to r_task() that query Salsa (for completions) happen on the main loop, during which the Salsa DB is pinned (since the main loop is the sole writer). But I thought better to be safe. We now:

  • Catch all panics in r_task() and reraise them. This is much safer, since it's UB to panic over C frames (top-level-exec and with-calling-handlers frames in particular). If a cancellation is ever raised from r_task() (e.g. if called from a background thread), it would be safely re-raised the same way, and would be caught by spawn_blocking().

  • Catch Salsa cancellation panics in respond() and reply to the frontend with ContentModified (follows Rust-Analyser).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant