Skip to content

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

Open
jkotas with Copilot wants to merge 14 commits into
mainfrom
copilot/fix-crossprocess-namedmutex-test
Open

Handle transient shared-memory directory state during named mutex open/create#130061
jkotas with Copilot wants to merge 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

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

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
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
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 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

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

5 participants