Remove panics from weave runtime to avoid undefined behavior in FFI #139
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
rust
technical-debt
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-seq#139
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
PR #138 introduced weave/generator support. The implementation includes several
panic!calls inextern "C"functions, which can cause undefined behavior when panicking across FFI boundaries.Current State
In
crates/runtime/src/weave.rs, thepatch_seq_yieldfunction has two panics:Line ~382 (yield channel send fails):
Line ~389 (resume channel recv fails):
Problem
Panicking in
extern "C"functions crosses the FFI boundary, which is undefined behavior in Rust. While these error conditions are unlikely in practice (channels are held by the caller), defensive code should avoid UB.Proposed Solution
Replace panics with the same blocking pattern used for cancellation:
This ensures we never panic across FFI, maintaining well-defined behavior.
Acceptance Criteria
panic!calls inpatch_seq_yieldpanic!calls inpatch_seq_resume(verify current state)Related
https://github.com/navicore/patch-seq/pull/144