From 363b43f7795cde52a30ac3cda0f767b03f024a98 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Sun, 19 Jul 2026 15:54:46 +0000 Subject: [PATCH] fix: prevent orphaned TaskCompletionSource in frame queue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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)). --- src/Heimdall.Agent/Services/FrameAnalyzerService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Heimdall.Agent/Services/FrameAnalyzerService.cs b/src/Heimdall.Agent/Services/FrameAnalyzerService.cs index e139e04..1d6375d 100644 --- a/src/Heimdall.Agent/Services/FrameAnalyzerService.cs +++ b/src/Heimdall.Agent/Services/FrameAnalyzerService.cs @@ -65,7 +65,10 @@ public sealed class FrameAnalyzerService : IDisposable _frameQueue = Channel.CreateBounded(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 });