You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segmentation fault when .NET starts JIT compilation of previous recorded methods triggered by ProfileOptimization.StartProfile #81799
The stack trace for the report on macOS M1 machine is attached below.
The stack trace suggests the crash happened when .NET starts JIT compilation of the previous recorded methods, which is triggered by the ProfileOptimization.StartProfile call in PowerShell.
We asked the user to delete the profile data file and try launch pwsh -c or pwsh -file again, and the user reported back that it began to work after removing the profile data file: PowerShell/PowerShell#18958 (comment). So, it's confirmed that this is an issue with the .NET profile optimization.
Reproduction Steps
The issue doesn't happen consistently. Even for the users who reported the issue, it was not consistent. They started with using PowerShell 7.3.1, which worked for a few days and then started to fail. Then they switched to PowerShell 7.3.0, which worked for a few days and started to fail again.
PowerShell 7.3.1 and PowerShell 7.3.0 are both on top of .NET 7.0.0
Expected behavior
No segmentation fault.
Actual behavior
Segmentation fault was reported.
Regression?
It's a regression, given that we don't have the problem in PowerShell 7.2.x versions, which are on top of .NET 6.
Known Workarounds
Deleting the profile data file, then pwsh -c and pwsh -file will start to work again.
Configuration
Which version of .NET is the code running on?
.NET 7.0.0
What OS and version, and what distro if applicable?
Redhat 7.9 and macOS M1 machine
What is the architecture (x64, x86, ARM, ARM64)?
For Redhat 7.9: Linux 3.10.0-1160.81.1.el7.x86_64
For macOS: ARM64
Any updates? We got another report of the issue in PowerShell repo, and this time it's on Ubuntu 22.04
The error occurs once a day only on a specific machine user, who executes a lot of pwsh scripts. After a reboot powershell is working fine for approx. 24 hours. Then the issue occus again.
We wrote an entire file processing framework using PowerShell, now the business team is thinking of rejecting the roll-out of this because of this problem and asking us to use Bash instead. Need this addressed. It is a regression and should receive attention.
Yes, PowerShell calls ProfileOptimization.SetProfileRoot/StartProfile at the entry point.
We don't have a dump available. If you can provide steps to collect a dump in this particular case, I think @bobrozelle may be able to help with that when the issue happens again in their environment.
The repro appears to be simple enough, if we have the right profile data file to cause the seg fault. When the seg fault is seen, and is reproducible with a simple pwsh command, could you please collect the profile data file and share it? I figure it may be reproducible elsewhere too with the same profile data file.
We are using pwsh scripts for monitoring several things with Check_MK/Nagios. It runs under one user account and fires up to 100 pwsh calls per minute and parallel. Basically i think we can into two "different" issues:
In irregular intervals we get the following error message. This can happen 4 times an hour or every 4 hour once, i was not able to constantly reproduce this error: kernel: [15300.129929] pwsh[1328960]: segfault at 28 ip 00007fb77a95fc30 sp 00007fb7739fe8e0 error 4 in libcoreclr.so[7fb77a82d000+383000]
Last week the whole "server" crashed and every pwsh call ends up with the following error. I was able to reproduce the error and temporarily fix it by deleting the file "StartupProfileData-NonInteractive": Stack overflow.
My workaround was just to downgrade powershell to version 7.1.x, since we had to upgrade to Ubuntu 22 the lowest available powershell version is 7.2.x and we again ran into this issue. I found another workaround to shut down creating the cache files and thus powershell is not using them:
I am not able to reproduce this error, and we only have one productive system with such a large amount of pwsh calls. So i think i am not able to deliver a "corrupt" profile data file. Let me know if i can help further.
Place the two files in this ZIP into %LOCALAPPDATA%\paint.net\Optimization: Startup.profiles.bad.zip
Try to start Paint.NET, either by double-clicking its icon or running paintdotnet.exe at the command-line
Expected: It works
Actual: App does not start, and you see errors in the event viewer like so:
If this isn't the same issue then I can file a new issue for it, but this is causing misery for a non-trivial number of people who use my app 😢 In the short-term I can just disable the use of ProfileOptimization and release a hotfix for the app
Activity
daxian-dbw commentedon Feb 22, 2023
Any updates? We got another report of the issue in PowerShell repo, and this time it's on Ubuntu 22.04
bobrozelle commentedon Mar 7, 2023
We wrote an entire file processing framework using PowerShell, now the business team is thinking of rejecting the roll-out of this because of this problem and asking us to use Bash instead. Need this addressed. It is a regression and should receive attention.
AndyAyersMS commentedon Mar 9, 2023
@mangod9 seems like a runtime issue?
mangod9 commentedon Mar 9, 2023
@davidwrighton @kouvel. Does Powershell use multicore JIT functionality? @daxian-dbw, is there a dump available to look at?
daxian-dbw commentedon Mar 9, 2023
Yes, PowerShell calls
ProfileOptimization.SetProfileRoot/StartProfileat the entry point.We don't have a dump available. If you can provide steps to collect a dump in this particular case, I think @bobrozelle may be able to help with that when the issue happens again in their environment.
kouvel commentedon Mar 28, 2023
The repro appears to be simple enough, if we have the right profile data file to cause the seg fault. When the seg fault is seen, and is reproducible with a simple pwsh command, could you please collect the profile data file and share it? I figure it may be reproducible elsewhere too with the same profile data file.
AdminValida commentedon May 2, 2023
Hi!
We are using pwsh scripts for monitoring several things with Check_MK/Nagios. It runs under one user account and fires up to 100 pwsh calls per minute and parallel. Basically i think we can into two "different" issues:
In irregular intervals we get the following error message. This can happen 4 times an hour or every 4 hour once, i was not able to constantly reproduce this error:
kernel: [15300.129929] pwsh[1328960]: segfault at 28 ip 00007fb77a95fc30 sp 00007fb7739fe8e0 error 4 in libcoreclr.so[7fb77a82d000+383000]Last week the whole "server" crashed and every pwsh call ends up with the following error. I was able to reproduce the error and temporarily fix it by deleting the file "StartupProfileData-NonInteractive":
Stack overflow.My workaround was just to downgrade powershell to version 7.1.x, since we had to upgrade to Ubuntu 22 the lowest available powershell version is 7.2.x and we again ran into this issue. I found another workaround to shut down creating the cache files and thus powershell is not using them:
I am not able to reproduce this error, and we only have one productive system with such a large amount of pwsh calls. So i think i am not able to deliver a "corrupt" profile data file. Let me know if i can help further.
Regards
mangod9 commentedon May 2, 2023
@AdminValida are you able to collect a dump when the segFault occurs? That might help diagnose the issue.
AdminValida commentedon May 3, 2023
@mangod9
As this is a production system our focus is to not have any segfaults :-)
But i ll try to reproduce the issue on the coming weekend. Maybe i can get both, a core dump and a "corrupted" profile file.
I'll keep you up to date
Regards
mangod9 commentedon May 3, 2023
yeah sounds good.
12 remaining items
rickbrew commentedon Nov 25, 2023
I believe I'm seeing this with Paint.NET. Or rather, I'm getting several reports of it. I've never had it manifest on its own on my system.
Steps to repro:
Download and install Paint.NET v5.0.11, or use the portable version. Both available here: https://github.com/paintdotnet/release/releases/tag/v5.0.11 . That version of Paint.NET is using .NET 7.0.12
Place the two files in this ZIP into
%LOCALAPPDATA%\paint.net\Optimization:Startup.profiles.bad.zip
paintdotnet.exeat the command-lineExpected: It works
Actual: App does not start, and you see errors in the event viewer like so:

If this isn't the same issue then I can file a new issue for it, but this is causing misery for a non-trivial number of people who use my app 😢 In the short-term I can just disable the use of
ProfileOptimizationand release a hotfix for the appPrevent dotnet/runtime#81799
Prevent dotnet/runtime#81799
Prevent dotnet/runtime#81799
Prevent dotnet/runtime#81799
Prevent dotnet/runtime#81799
Prevent dotnet/runtime#81799
Prevent dotnet/runtime#81799
Prevent dotnet/runtime#81799
Prevent dotnet/runtime#81799
Use multiplatform build
rickbrew commentedon Apr 29, 2024
Judging by commits, this appears to be fixed? Should the issue be closed?
mangod9 commentedon Apr 29, 2024
yeah this could be closed I think @kg / @steveisok ?