-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix IPC default named pipe clean up on exit #12187
Fix IPC default named pipe clean up on exit #12187
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Windows PowerShell we were using the CLR Appdomain unload event to dispose of the server pipe, but that is not implemented in dotNet core.
Is this a fundamental Unix behavior/problem or we should open an issue in .Net repo to request a fix?
src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Core/Get-PSHostProcessInfo.Tests.ps1
Show resolved
Hide resolved
…rPSHostProcessCommand.cs Co-Authored-By: Ilya <darpa@yandex.ru>
src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs
Show resolved
Hide resolved
src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs
Show resolved
Hide resolved
src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs
Show resolved
Hide resolved
@PoshChan Please rerun tests |
@PaulHigin, I do not understand the build target(s) |
@PoshChan Please rerun all |
@PaulHigin, successfully started rebuild of |
src/System.Management.Automation/engine/remoting/commands/EnterPSHostProcessCommand.cs
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Core/Get-PSHostProcessInfo.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Core/Get-PSHostProcessInfo.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Core/Get-PSHostProcessInfo.Tests.ps1
Outdated
Show resolved
Hide resolved
…ocessInfo.Tests.ps1 Co-Authored-By: Steve Lee <slee@microsoft.com>
…ocessInfo.Tests.ps1 Co-Authored-By: Steve Lee <slee@microsoft.com>
…ocessInfo.Tests.ps1 Co-Authored-By: Steve Lee <slee@microsoft.com>
@PoshChan Please rerun all |
@PaulHigin, successfully started rebuild of |
PowerShell 7.1.0-preview.1 on debian 9.12 Problem still exists. Every time i power up a console (pwsh-preview) it creates something like |
@MaFreiberger It is not in Preview1. You can load nightly build or wait next Preview. |
🎉 Handy links: |
Should this be backported to PowerShell 7.0? |
Have we requests for this? User can already migrate to 7.1. |
Just labelled this as backport consider so that we can discuss whether this should be backported (since otherwise the LTS will just pollute named pipes onto the system). Just a suggestion though -- we can skip it if it's not thought to be severe. |
🎉 Handy links: |
PR Summary
This PR addresses #11599. On Linux platforms, the default named pipe file was not getting cleaned up on PowerShell exit.
PR Context
Windows PowerShell uses the CLR Appdomain unload event to dispose the NamedPipeServerStream object on exit, but that does not work with .NET core runtime. This was not a problem on Windows platforms because the Windows OS releases all process resources on process exit, including named pipes.
Fix is to change this to use the CLR 'ProcessExit' event.
Note that this only works when PowerShell exits normally, i.e., via the 'exit' command. If the console or terminal window is closed then the CLR cannot fire the event.
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.