fix: prevent orphaned TaskCompletionSource in frame queue

Changed BoundedChannelFullMode from DropOldest to DropWrite.
With DropOldest, the oldest queued job is silently removed when the
channel is full, but its TaskCompletionSource is never completed —
causing the caller to hang indefinitely.

DropWrite rejects new writes when full, returning TryWrite=false,
which triggers the existing graceful fallback (tcs.TrySetResult(null)).
This commit is contained in:
Arnaud Dartois committed 2026-07-19 15:54:46 +00:00
1 parent d9f5224e21
commit 363b43f779
1 file changed
+4 -1
@@ -65,7 +65,10 @@ public sealed class FrameAnalyzerService : IDisposable
_frameQueue = Channel.CreateBounded<FrameJob>(new BoundedChannelOptions(MaxQueueSize)
{
FullMode = BoundedChannelFullMode.DropOldest,
// DropWrite rejects new writes when full with TryWrite=false,
// allowing the caller to gracefully complete the TCS with null.
// DropOldest would orphan the oldest job's TaskCompletionSource.
FullMode = BoundedChannelFullMode.DropWrite,
SingleReader = true,
SingleWriter = false
});