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
pwsh segmentation fault when running -Command or -File #18958
We have installed Powershell 7.3.1 using Yum on a Redhat 7.9 OS. We are getting an intermittent Segmentation Fault when attempting to run either a -File or a -Command using pwsh. It does not happen when we just run pwsh. The behavior is very strange. For example, if I run "pwsh -Command {Write-Host 'hello'}" I will get Segmentation Fault, then after a few tries, it may (or may not) start working as expected. this will continue to work until after the weekend, then it stops working. I am trying to find out what the client sysadmins are doing on the weekend (probably running a Yum update, maybe a system reboot?) So yea, not a lot to go on.
Expected behavior
'hello'
Actual behavior
Segmentation Fault
Error details
Can't provide since Segmentation Fault occurs immediately.
Environment data
Name Value
---------
PSVersion 7.3.1
PSEdition Core
GitCommitId 7.3.1
OS Linux 3.10.0-1160.81.1.el7.x86_64 #1 SMP Thu Nov 24 12:21:22 UTC 2022
Platform Unix
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Not able to duplicate the error, Linux environment has been configured to use 7.3.0 by default and I think that is keeping everything running, so that even when I attempt testing using 7.3.1, the problem does not occur.
The problem showed up again using 7.3.0. We removed the StartupProfileData-NonInteractive file under /home//.cache/powershell as recommended by Issue 18998 and pwsh with a -file argument began to work again!
Reacted by Dongbo Wang, Keith Hill, mcclurekr and amarconiGIT
I also ran into this issue on Ubuntu 22. 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. While the issue is appearing on the users account, another user can execute the same script flawlessly.
Dongbo Wang (@daxian-dbw) After deleting the file the execution of several scripts runs without any problems as well. Are there any expected downsides if I delete the file via crontab every hour?
Just a side note an Ubuntu 20 LTS with powershell 7.3.1 runs just fine without any problems.
Thanks for verifying the workaround!
For automation runs, there is no downside. That file is for faster startup, which is less interesting for automation jobs.
As a permanent workaround, I think you should add an input parameter to 'pwsh' to clear the cash prior to execution. Something like "-clearcache" That gives us a fix now and in the future if this ever crops up again.
I don't think we will add a switch flag just for a workaround. It would be better for you to comment in the .NET issue, so that we can get more attention from the .NET team for fixing the root problem.
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.
Bob Rozelle (@bobrozelle) I'm sorry that it turns out to be such an annoying blocking issue for you. I just posted the issue to the internal channel for the .NET team and hope we can get some traction by doing that.
At the meantime, can you please consider using v7.2.x of PowerShell instead? It's a LTS version, the latest version is v7.2.10. We have NOT heard any reports about this "seg fault" issue with the v7.2.x versions, so you can avoid this issue by moving to v7.2 for now.
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 15, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 22, 2023
Activity
daxian-dbw commentedon Jan 30, 2023
Bob Rozelle (@bobrozelle) can you please take a look at #18998 (comment) and also verify if that's that case for you?
bobrozelle commentedon Jan 31, 2023
Not able to duplicate the error, Linux environment has been configured to use 7.3.0 by default and I think that is keeping everything running, so that even when I attempt testing using 7.3.1, the problem does not occur.
bobrozelle commentedon Feb 3, 2023
The problem showed up again using 7.3.0. We removed the StartupProfileData-NonInteractive file under /home//.cache/powershell as recommended by Issue 18998 and pwsh with a -file argument began to work again!
daxian-dbw commentedon Feb 6, 2023
Bob Rozelle (@bobrozelle) Thanks for the updates! Then the theory should be correct, and I will open an issue to the dotnet/runtime repo.
daxian-dbw commentedon Feb 7, 2023
.NET issue opened: dotnet/runtime#81799
BlacksWise commentedon Feb 21, 2023
I also ran into this issue on Ubuntu 22. 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. While the issue is appearing on the users account, another user can execute the same script flawlessly.
daxian-dbw commentedon Feb 21, 2023
BlacksWise Please try the workaround specified in #18998 (comment), and help verify if that works for you.
BlacksWise commentedon Feb 22, 2023
Dongbo Wang (@daxian-dbw) After deleting the file the execution of several scripts runs without any problems as well. Are there any expected downsides if I delete the file via crontab every hour?
Just a side note an Ubuntu 20 LTS with powershell 7.3.1 runs just fine without any problems.
daxian-dbw commentedon Feb 22, 2023
Thanks for verifying the workaround!
For automation runs, there is no downside. That file is for faster startup, which is less interesting for automation jobs.
bobrozelle commentedon Mar 6, 2023
As a permanent workaround, I think you should add an input parameter to 'pwsh' to clear the cash prior to execution. Something like "-clearcache" That gives us a fix now and in the future if this ever crops up again.
daxian-dbw commentedon Mar 6, 2023
I don't think we will add a switch flag just for a workaround. It would be better for you to comment in the .NET issue, so that we can get more attention from the .NET team for fixing the root problem.
daxian-dbw commentedon Mar 7, 2023
From dotnet/runtime#81799 (comment):
Bob Rozelle (@bobrozelle) I'm sorry that it turns out to be such an annoying blocking issue for you. I just posted the issue to the internal channel for the .NET team and hope we can get some traction by doing that.
At the meantime, can you please consider using v7.2.x of PowerShell instead? It's a LTS version, the latest version is v7.2.10. We have NOT heard any reports about this "seg fault" issue with the v7.2.x versions, so you can avoid this issue by moving to v7.2 for now.
microsoft-github-policy-service commentedon Nov 15, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 15, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 15, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 22, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.