Commit a0cfda5
Fix CPU hang in BatchingChannelReader.WaitToReadAsyncCore
The issue was that after Task.WhenAny completed, the code did not await
the source task before looping. This caused a tight CPU-consuming loop
when the source channel was closed but the buffer was empty, as the
closed source would immediately return a completed ValueTask on each
WaitToReadAsync call.
The fix properly awaits the source task after WhenAny to check its
completion status, preventing the tight loop. This matches the pattern
used in the base BufferingChannelReader class.
Co-authored-by: electricessence <5899455+electricessence@users.noreply.github.com>1 parent 08900d6 commit a0cfda5
1 file changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
| 249 | + | |
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
255 | 262 | | |
256 | 263 | | |
257 | 264 | | |
| |||
0 commit comments