dotnet / dotnet/runtime

Parallel Powershell sessions lead to corruption of the StartUpProfileData cache created by `ProfileOptimization.StartProfile`

Open
#121,977 5 comments 0 reactions 0 assignees View on GitHub
area-VM-coreclr
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

### Description

We PowerShell team got a new report about the profile data created by `ProfileOptimization.StartProfile` got corrupted by parallel PowerShell session started by `pwsh -command`. This happened on macOS and GitLab runners with PowerShell v7.5.4, which runs on top of **.NET 9.0**.

- https://github.com/PowerShell/PowerShell/issues/26528

Please see the detailed bug report in the PowerShell issue, including a `.ips` crash report collected on macOS.

I reported a similar issue #81799 a couple years back, and that was fixed in .NET 9.0. However, this still happens on .NET 9, indicating that the root cause may be different. /cc @mangod9 and @kouvel from #81799.

### Reproduction Steps

The PowerShell issue https://github.com/PowerShell/PowerShell/issues/26528 has the repro script.

### Expected behavior

The profile file created by parallel PowerShell doesn't get corrupted.

### Actual behavior

The profile seems corrupted by parallel PowerShell session.

### Regression?

It could be a regression. We didn't hear the same issue before.

### Known Workarounds

There is no workaround. Deleting the profile can temporarily fix the issue, but the next parallel run of PowerShell may run into the same issue.

### Configuration

**Which version of .NET is the code running on?**
.NET 9

**What OS and version, and what distro if applicable?**
GitLab runners on macOS that don't use any sort of virtualization

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.