Commit 4d798bb
committed
[ogar-adapter-csharp] serialize dotnet invocations — fix flaky NuGet-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>1 parent 1d4c22c commit 4d798bb
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
17 | 33 | | |
18 | 34 | | |
19 | 35 | | |
| |||
116 | 132 | | |
117 | 133 | | |
118 | 134 | | |
| 135 | + | |
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
| |||
144 | 161 | | |
145 | 162 | | |
146 | 163 | | |
| 164 | + | |
147 | 165 | | |
148 | 166 | | |
149 | 167 | | |
| |||
0 commit comments