Skip to content

Enforce panic catching in the Oak LSP - #1406

Merged
lionel- merged 10 commits into
mainfrom
oak-panic/enforce
Sep 25, 2026
Merged

lionel- merged 10 commits into
mainfrom
oak-panic/enforce

Conversation

@lionel-

@lionel- lionel- commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1405.

This PR enforces good panic catching conventions for Salsa accesses.

  • All Salsa DB access now go through dedicated accessors that check whether a "panic boundary" (i.e. a catch site) is active on the stack. This ensures that new code/handlers in the Oak LSP are properly guarded against panics.

  • A clippy rule disallows bare panic catching. Instead the codebase must now use crate::panic::catch_unwind() which declares a panic boundary.

  • Add boundaries around Tokio tasks and processes.

Positron Release Notes

New Features

  • N/A

Bug Fixes

  • N/A

@lionel-
lionel- added this pull request to stack #1407 September 11, 2026 15:03
@lionel-
lionel- requested a review from thomasp85 September 11, 2026 15:23
Base automatically changed from oak-panic/catch to main September 16, 2026 10:36
@lionel-
lionel- force-pushed the oak-panic/enforce branch 3 times, most recently from b77235a to 5af7b79 Compare September 16, 2026 11:10
Comment thread crates/ark/src/debug.rs Outdated

// We protect from panics to correctly restore `captured_output`'s state.
// The panic is resumed right after.
#[expect(clippy::disallowed_methods)]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a comment on this to clarify why we allow a raw catch_unwind here with no boundary? (if I understand the new architecture correctly)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the intent is to let panics thrown from the C debugger to take its course.

But I see below we use resume_unwind(), which doesn't invoke the panic hook, so could leave the process in a bad state (although we're on the main thread so likely not).

I've changed it to properly catch and recover. This is low stake, only used for debugging Ark (and I haven't used these helpers for a long time).

@thomasp85 thomasp85 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Do we have any way of ensuring that future tokyo processes are correctly handled so errors in subprocesses can't bring the whole thing down?

@lionel-

lionel- commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Do we have any way of ensuring that future tokyo processes are correctly handled so errors in subprocesses can't bring the whole thing down?

I've added a lint for tokio::spawn() that we can try out.

@lionel-
lionel- merged commit c5df06d into main Sep 25, 2026
17 checks passed
@lionel-
lionel- deleted the oak-panic/enforce branch September 25, 2026 14:40
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants