Commit 683eddc
committed
stream: resume flow when an errored pipe destination is removed
When a source is piped to multiple destinations and one destination
errors synchronously in `_write()`, `write()` returns false without
setting `needDrain` (since the "avoid unnecessary drain for sync
stream" change). The pipe cleanup only re-invoked the source's drain
handler when the destination still had `needDrain` set, so the errored
destination was never removed from the source's `awaitDrainWriters`
set. The source stayed paused forever and any remaining healthy
destination stopped receiving data.
Always invoke the drain handler during cleanup. `pipeOnDrain` only
removes this destination from the awaiting-drain set and resumes the
source once nothing else is awaiting a drain, so it is safe to call
unconditionally and no-ops when this destination was not awaiting a
drain.
Fixes: #53185
Signed-off-by: Mahin Anowar <86069420+MahinAnowar@users.noreply.github.com>1 parent 4d27d80 commit 683eddc
2 files changed
Lines changed: 55 additions & 3 deletions
File tree
- lib/internal/streams
- test/parallel
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
985 | 985 | | |
986 | 986 | | |
987 | 987 | | |
988 | | - | |
989 | | - | |
990 | | - | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
991 | 995 | | |
992 | 996 | | |
993 | 997 | | |
| |||
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
0 commit comments