Skip to content

Honor bounded LogStream backpressure for synchronous writes#45

Merged
CypherPotato merged 1 commit into
mainfrom
codex/fix-server-crash-due-to-bounded-log-queue
May 29, 2026
Merged

Honor bounded LogStream backpressure for synchronous writes#45
CypherPotato merged 1 commit into
mainfrom
codex/fix-server-crash-due-to-bounded-log-queue

Conversation

@CypherPotato
Copy link
Copy Markdown
Member

Motivation

  • A bounded Channel<object> with FullMode=Wait was introduced but synchronous LogStream writes used TryWrite and threw InvalidOperationException when the queue was full, which can propagate from request-finally logging and cause availability loss under log-flooding.
  • Make a minimal, targeted change so synchronous write callers block on the channel like the async path, eliminating queue-full exceptions while preserving shutdown semantics.

Description

  • Replace the throwing TryWrite path in LogStream.WriteLineInternal(string) with a synchronous wait on ChannelWriter.WriteAsync(...).GetAwaiter().GetResult() so writes honor bounded-channel backpressure.
  • Swallow ChannelClosedException and OperationCanceledException when cancellation is requested to preserve safe shutdown behavior consistent with the async writer.
  • Keep all other async write logic and output-writing behavior unchanged for minimal surface impact.

Testing

  • Ran dotnet test tests/Sisk.Core/tests.csproj --filter LogStream which restored and built projects successfully but the testhost failed to launch because the environment has only .NET 10 while tests target .NET 9, so tests could not be executed.
  • An earlier incorrect test invocation (tests/Sisk.Core/Sisk.Core.Tests.csproj) failed due to a missing project file and was retried with the correct path prior to the environment/runtime failure.
  • No test failures from compilation were observed; runtime test execution was blocked by the missing target framework in this environment.

Codex Task

@CypherPotato CypherPotato merged commit 39876c8 into main May 29, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant