Skip to content

pwsh segmentation fault when running -Command or -File #18958

Closed

Description

Prerequisites

Steps to reproduce

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

Visuals

No response

Activity

  1. added
    Needs-Triage
    on Jan 17, 2023
  2. daxian-dbw commented on Jan 30, 2023

    @daxian-dbw
    Member

    Bob Rozelle (@bobrozelle) can you please take a look at #18998 (comment) and also verify if that's that case for you?

  3. bobrozelle commented on Jan 31, 2023

    @bobrozelle
    Author

    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.

  4. bobrozelle commented on Feb 3, 2023

    @bobrozelle
    Author

    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!

  5. daxian-dbw commented on Feb 6, 2023

    @daxian-dbw
    Member

    Bob Rozelle (@bobrozelle) Thanks for the updates! Then the theory should be correct, and I will open an issue to the dotnet/runtime repo.

  6. daxian-dbw commented on Feb 7, 2023

    @daxian-dbw
    Member

    .NET issue opened: dotnet/runtime#81799

  7. removed
    Needs-Triage
    on Feb 8, 2023
  8. BlacksWise commented on Feb 21, 2023

    @BlacksWise

    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.

  9. daxian-dbw commented on Feb 21, 2023

    @daxian-dbw
    Member

    BlacksWise Please try the workaround specified in #18998 (comment), and help verify if that works for you.

  10. BlacksWise commented on Feb 22, 2023

    @BlacksWise

    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.

  11. daxian-dbw commented on Feb 22, 2023

    @daxian-dbw
    Member

    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.

  12. bobrozelle commented on Mar 6, 2023

    @bobrozelle
    Author

    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.

  13. daxian-dbw commented on Mar 6, 2023

    @daxian-dbw
    Member

    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.

  14. daxian-dbw commented on Mar 7, 2023

    @daxian-dbw
    Member

    From dotnet/runtime#81799 (comment):

    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.

  15. added
    Waiting - DotNetCore
    on Mar 8, 2023
  16. microsoft-github-policy-service commented on Nov 15, 2023

    @microsoft-github-policy-service
    Contributor

    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.

  17. microsoft-github-policy-service commented on Nov 15, 2023

    @microsoft-github-policy-service
    Contributor

    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.

  18. added
    Resolution-No Activity
    on Nov 15, 2023
  19. microsoft-github-policy-service commented on Nov 15, 2023

    @microsoft-github-policy-service
    Contributor

    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.

  20. microsoft-github-policy-service commented on Nov 22, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-No ActivityWG-Maintainers-BuildWaiting - DotNetCore

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions