Skip to content

[ogar-adapter-csharp] serialize dotnet invocations — fix flaky NuGet-…#185

Closed
AdaWorldAPI wants to merge 1 commit into
mainfrom
claude/csharp-parity-dotnet-home-isolation
Closed

[ogar-adapter-csharp] serialize dotnet invocations — fix flaky NuGet-…#185
AdaWorldAPI wants to merge 1 commit into
mainfrom
claude/csharp-parity-dotnet-home-isolation

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Closing as superseded by #186 — this fix is already on main.
crates/ogar-adapter-csharp/tests/parity.rs on main already contains the identical serialization fix: use std::sync::Mutex;, static DOTNET_GATE: Mutex<()> = Mutex::new(());, and let _gate = DOTNET_GATE.lock().unwrap_or_else(|e| e.into_inner()); at the top of both parity tests. The code is byte-identical, and main's doc comment is a superset — it folded in the dotnet-sdk 8.0.128 numbers (per-test env isolation still flakes ~4/6 cold; serialized cold-start ×8 → 8/8 green) that this branch only carried in the PR description.
The dirty/conflict state is just because #185 and #186 touched the same lines — nothing here is still needed. Resolving the conflict would produce a no-op diff (or downgrade main's comment). Nothing to merge.

…migration shm race

The parity tests shell out to dotnet on two threads. On a cold runner
(~/.dotnet absent), each first dotnet process runs .NET's first-time-use
NuGet migration, which opens a named mutex under /tmp/.dotnet/shm/session<N>.
Two migrations racing lose with mkdir==EEXIST / stat==ENOENT — the
intermittent failure seen on OGAR #179 (main was green on the same commit).

A static Mutex gate serializes all dotnet invocations, so the migration
completes once uncontended and later calls skip it. Verified with dotnet-sdk
8.0.128: cold-start (rm -rf /tmp/.dotnet before each run) x8 -> 8/8 green;
the same stress on the unserialized code flakes ~4/6.

Note: an earlier attempt isolated TMPDIR/HOME/DOTNET_CLI_HOME/NUGET_PACKAGES
per test — that does NOT work; the shm dir stays at /tmp/.dotnet/shm
regardless of those vars (empirically confirmed), so serialization, not env
relocation, is the fix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cursor

cursor Bot commented Jul 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_a1faa2de-ac74-46e8-9f21-77a02ad154de)

@AdaWorldAPI AdaWorldAPI closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants