You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stream/iter: falsy cancellation reasons become clean EOF in broadcast and share #64704
But every read site tests the stored value for truthiness, so a falsy reason is invisible and the consumer falls through to the clean-completion path instead:
broadcast.js: L179, L196, L341
share.js (Share): L132, L144, L170, L179, L263
share.js (SyncShare): L473, L538
The obvious fix (#error !== null) doesn't work, because those fields initialize to null — so cancel(null) would still be indistinguishable from "never cancelled".
push.js already solves exactly this problem with a symbol sentinel:
Activity
theSnackOverflow commentedon Jul 31, 2026
I'd like to work on this. Here's what I found while tracing it:
cancel()stores falsy reasons correctly — it guards onreason !== undefined:node/lib/internal/streams/iter/broadcast.js
Lines 240 to 242 in 598693b
But every read site tests the stored value for truthiness, so a falsy reason is invisible and the consumer falls through to the clean-completion path instead:
broadcast.js: L179, L196, L341share.js(Share): L132, L144, L170, L179, L263share.js(SyncShare): L473, L538The obvious fix (
#error !== null) doesn't work, because those fields initialize tonull— socancel(null)would still be indistinguishable from "never cancelled".push.jsalready solves exactly this problem with a symbol sentinel:Would applying that same sentinel pattern to
Broadcast,Share, andSyncSharebe the direction you'd want here? Happy to open a PR if so.trivikr commentedon Jul 31, 2026
A fix has been up at #64705 for a week
stream: preserve falsy cancellation reasons
stream: preserve falsy cancellation reasons
stream: preserve falsy cancellation reasons
stream: preserve falsy cancellation reasons