fix(daemon): use Workstation GC for netclawd (#1294)#1295
Merged
Aaronontheweb merged 2 commits intoJun 2, 2026
Conversation
netclawd builds on the Web SDK, which defaults ServerGarbageCollection to true. The daemon is a single-tenant, low-concurrency process typically run in a memory-limited container, where Server GC inflates peak RSS and is slow to return memory to the OS — turning transient allocation spikes into cgroup OOM kills. Switch to Workstation GC with background collection. Verified System.GC.Server=false in the generated netclawd.runtimeconfig.json.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switches
netclawdfrom Server GC to Workstation GC (with background collection).Netclaw.Daemonbuilds onMicrosoft.NET.Sdk.Web, which defaultsServerGarbageCollectiontotrue. There was no override, so the daemon shipped with Server GC. That's the wrong trade for this process:netclawdis single-tenant and low-concurrency — one operator, a handful of sessions, a SignalR gateway and webhook listener.This came out of investigating real OOM kills on a log-pulling daemon. The root allocation problem is tracked separately (#1293, unbounded
shell_executeoutput buffering); Server GC is what turned that spike into a kill instead of a hiccup.Change
Verification
dotnet build -c Releaseclean (0 warnings, 0 errors).netclawd.runtimeconfig.jsonnow emitsSystem.GC.Server: falseandSystem.GC.Concurrent: true.Notes for review
Worth a sanity check that no high-throughput self-hosted deployment is leaning on Server GC. For the agent's actual concurrency profile, Workstation should be the better default. Easy to revert or make environment-conditional (
DOTNET_gcServer) if needed.Closes #1294.