Repository navigation
Closed
Labels
Issue-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreWG-Maintainers-Buildspecific to affecting the build
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
I'm not entirely sure this would be easily reproducible on somebody else's M1. My M1 build machine was working just fine as a Jenkins build agent until I rebooted it this evening. Then my builds started hanging on this node where it first tries to run a PowerShell script. After some debugging, I found out that trying to launch pwsh -c '<command>' causes a segmentation fault. Same with -file. What's odd is that I can start pwsh just fine:
Expected behavior
Well, PowerShell should not crash, right?Actual behavior
I'm seeing a segmentation fault.Error details
% pwsh -nop -c 'get-date'
zsh: segmentation fault pwsh -nop -c 'get-date'Environment data
Name Value
---- -----
PSVersion 7.3.1
PSEdition Core
GitCommitId 7.3.1
OS Darwin 21.6.0 Darwin Kernel Version 21.6.0: Sun Nov 6 23:29:57 PST 2022; root:xnu-8020…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Also:
% which pwsh
/usr/local/bin/pwsh
% ls -al /usr/local/bin/pwsh
lrwxr-xr-x 1 root wheel 38 Jan 20 21:42 /usr/local/bin/pwsh -> /usr/local/microsoft/powershell/7/pwsh
# I also have several versions of the .NET SDK and Runtime installed on this system. That shouldn't matter, right?
% dotnet --info
.NET SDK:
Version: 7.0.100
Commit: e12b7af219
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.6
OS Platform: Darwin
RID: osx.12-arm64
Base Path: /usr/local/share/dotnet/sdk/7.0.100/
Host:
Version: 7.0.0
Architecture: arm64
Commit: d099f075e4
.NET SDKs installed:
6.0.403 [/usr/local/share/dotnet/sdk]
6.0.404 [/usr/local/share/dotnet/sdk]
7.0.100 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.12 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
x64 [/usr/local/share/dotnet/x64]
registered at [/etc/dotnet/install_location_x64]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/downloadVisuals
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreWG-Maintainers-Buildspecific to affecting the build


Activity
rkeithhill-keysight commentedon Jan 21, 2023
BTW I tried
-nopand still get a seg fault:rkeithhill-keysight commentedon Jan 21, 2023
FYI, downgrading to 7.3.0 has fixed this issue.
bobrozelle commentedon Jan 24, 2023
Same behavior as #18958
rkeithhill-keysight commentedon Jan 25, 2023
After 4 days of using 7.3.0 in my Jenkins pipeline (pwsh -c), 7.3.0 is now seg faulting on this command!
WTF? Steve Lee (@SteveL-MSFT) Any suggestions on a potential workaround - other than uninstalling and installing a different version? That only seems to work for a few days. This is impacting our product devops because we use PowerShell to orchestrate build & test on Mac M1.
rkeithhill-keysight commentedon Jan 25, 2023
I removed 7.3.0 and installed 7.3.2 (that must be pretty new) and now
pwsh -cworks again. Let's see how long 7.3.2 can go before it starts seg faulting. :-)SteveL-MSFT commentedon Jan 27, 2023
Unfortunately, not able to repro this. Was able to find two PRs in dotnet/runtime that is related to the area given the stacktrace (thanks!) https://github.com/dotnet/runtime/search?q=issharedbygenericinstantiations&type=issues. Need to look deeper next week.
daxian-dbw commentedon Jan 30, 2023
The puzzling part in the report is that the crash doesn't happen consistently -- it started to happen after using 7.3.0 for 4 days.
The stack trace suggests the crash happened when JIT start profile kicks in, which does early compilation on the methods that were used the last time
pwshgoing through the same code path -- in this case forpwsh -corpwsh -file, non-interactive execution (ProfileOptimization.StartProfile("StartupProfileData-NonInteractive")).So, it makes sense that running
pwshitself works, because that will be interactive execution, which will be using a different profile: ProfileOptimization.StartProfile("StartupProfileData-Interactive").Keith Hill (@rkeithhill-keysight) Can you please try the following when
pwsh -c "get-date"results in segment fault, and see if the next run ofpwsh -cworks:StartupProfileData-NonInteractivefile under/home/<user-name>/.cache/powershellHaving this file removed will make CLR not attempt to do the early method compilation, so if this theory is correct, the next run of
pwsh -c "get-date"should work again. If you can verify this is the case, I will open an issue on this in the .NET repo.rkeithhill-keysight commentedon Jan 30, 2023
Dongbo Wang (@daxian-dbw) Yes, I'll give that a try if/when we encounter the seg fault again.
daxian-dbw commentedon Feb 7, 2023
.NET issue opened: dotnet/runtime#81799
rkeithhill-keysight commentedon Jun 3, 2023
And now 7.3.2 has started to gen seg faults ~5 1/2 months after installing 7.3.2. 🤷♂️
I tried Dongbo Wang (@daxian-dbw) suggestion to remove the
StartupProfileData-NonInteractivefile and that fixes it. Not sure how long the fix will last but my CI/CD builds are running again on this M1 mini.daxian-dbw commentedon Jun 5, 2023
Keith Hill (@rkeithhill-keysight) The root cause is in .NET, see dotnet/runtime#81799. Please try collecting a dump when the crash happens, and share the dump in the .NET issue -- they need a dump to further investigate the issue (see dotnet/runtime#81799 (comment)).
rkeithhill-keysight commentedon Jun 5, 2023
I read the .NET issue after I had fixed it. 🤦♂️ Next time this happens, I'll collect a dump and post it there.
GordonVi commentedon Jul 12, 2023
Just ran into this after updating powershell on CentOS:
pwsh 7.3.5 (old was 7.3.4)
commands:
update powershell
sudo yum update powershell
Set permissions for powershell to run commands
sudo setcap cap_net_raw=eip /opt/microsoft/powershell/7/pwsh # real binary, not symlink
rename offending config file
mv /home/user/.cache/powershell/StartupProfileData-NonInteractive /home/user/.cache/powershell/StartupProfileData-NonInteractive.disable
rkeithhill-keysight commentedon Sep 20, 2024
FWIW it appears this issue was fixed in .NET. Here's the .NET issue and here's the PR that fixes it.
pregress commentedon Feb 25, 2025
Can this be re-opend please?
I had the same issue on 7.5.0.
Disabling the file:
mv ~/.cache/powershell/StartupProfileData-NonInteractive ~/.cache/powershell/StartupProfileData-NonInteractive.disablesolved it, as suggested by Gordon Virasawmi (@GordonVi)