Skip to content

Handle transient shared-memory directory state during named mutex open/create#130061

Merged
jkotas merged 14 commits into
mainfrom
copilot/fix-crossprocess-namedmutex-test
Jul 6, 2026
Merged

Handle transient shared-memory directory state during named mutex open/create#130061
jkotas merged 14 commits into
mainfrom
copilot/fix-crossprocess-namedmutex-test

Conversation

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

MutexTests.CrossProcess_NamedMutex_ConcurrentCreateOrOpen was failing in CI on Unix when one process observed /tmp/.dotnet*/shm between directory creation and final ownership/permission normalization. This change makes named mutex shared-memory directory validation tolerate that transient state instead of failing the open/create path.

  • Directory race handling

    • Extend SharedMemoryHelpers.EnsureDirectoryExists with the same short transient retry model already used for shared-memory files.
    • Retry when stat/validation sees a directory before the creating process has finished applying the expected owner or mode.
  • Failure modes addressed

    • User-scoped directories temporarily reported as owned by the wrong UID.
    • Non-user-scoped directories temporarily reported without the expected owner permissions.

Fixes #130056

Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 1, 2026 01:50
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 1, 2026 01:57
Copilot AI changed the title [WIP] Fix failing CrossProcess_NamedMutex_ConcurrentCreateOrOpen test in CI Handle transient shared-memory directory state during named mutex open/create Jul 1, 2026
Copilot AI requested a review from jkotas July 1, 2026 01:58
Copilot finished work on behalf of jkotas July 1, 2026 01:58
Comment thread src/libraries/System.Private.CoreLib/src/System/IO/SharedMemoryManager.Unix.cs Outdated
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 1, 2026 02:57
Copilot finished work on behalf of jkotas July 1, 2026 03:03
Copilot AI requested a review from jkotas July 1, 2026 03:03
Comment thread src/libraries/System.Private.CoreLib/src/System/IO/SharedMemoryManager.Unix.cs Outdated
Comment thread src/libraries/System.Private.CoreLib/src/System/IO/SharedMemoryManager.Unix.cs Outdated
Copilot AI removed the request for review from Copilot July 3, 2026 01:22
Copilot finished work on behalf of jkotas July 3, 2026 01:23
Copilot AI requested a review from jkotas July 3, 2026 01:23
@jkotas

jkotas commented Jul 3, 2026

Copy link
Copy Markdown
Member

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkotas

jkotas commented Jul 3, 2026

Copy link
Copy Markdown
Member

/ba-g infrastructure timeouts, no failures in extra platforms related to the fix (too many failures in extra platforms for BA to analyze)

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @VSadov
See info in area-owners.md if you want to be subscribed.

@jkotas jkotas merged commit 640673e into main Jul 6, 2026
177 of 196 checks passed
@jkotas jkotas deleted the copilot/fix-crossprocess-namedmutex-test branch July 6, 2026 23:16
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

System.Threading.Tests.MutexTests.CrossProcess_NamedMutex_ConcurrentCreateOrOpen failing in CI

5 participants