chan.close does not unblock subsequent chan.receive (blocks forever instead of returning false) #499
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#499
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?
Summary
A
chan.receiveon a closed and fully-drained channel blocks indefinitely instead of returning( default false ). This contradicts the behavior documented in the seqlings curriculum (exercises/24-channels/README.mdandexercises/24-channels/04-close.seq).Behavior reproduces both in single-strand code and in the standard CSP cross-strand pattern (producer strand sends, closes, exits; consumer reads past end).
Affects:
seqc 7.4.0Documented behavior
exercises/24-channels/README.md:exercises/24-channels/04-close.seq:Reproducer 1 — single strand
seqc test test-min-single.seqnever returns; aborted by 4-second timeout.Reproducer 2 — cross-strand (canonical CSP pattern)
Same outcome: hangs at the third
chan.receive. The producer strand has fully exited afterchan.close, so no sender-side references remain.Expected behavior
Per the documented contract, the third
chan.receiveshould return( default false )once the channel is closed and drained. Theifwould then take the else branch and the test would pass.Actual behavior
The third
chan.receiveblocks forever — no other strand will ever send to the channel, but the runtime does not detect the closed-and-drained condition.Impact
This blocks the canonical CSP "producer closes, consumer loops on success-flag" pattern in any user code. In the seqlings curriculum it blocks a planned ch 35 (Little's Law) redesign that needs recursive worker strands terminating on a closed work channel; we're pivoting to a fixed K-workers-for-K-items pattern as a workaround. The README at
exercises/24-channels/README.mdshould also be updated to match whichever behavior is intended.Probable area
crates/runtimechannel implementation — specifically the path that decides whether a blockedchan.receiveshould wake withfalsewhen the queue is empty and the close flag is set.#502