Fix IPC default named pipe clean up on exit#12187
Fix IPC default named pipe clean up on exit#12187daxian-dbw merged 9 commits intoPowerShell:masterfrom PaulHigin:fix-namedpiperesource-onexit
Conversation
iSazonov
left a comment
There was a problem hiding this comment.
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 <[email protected]>
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 <[email protected]>
…ocessInfo.Tests.ps1 Co-Authored-By: Steve Lee <[email protected]>
…ocessInfo.Tests.ps1 Co-Authored-By: Steve Lee <[email protected]>
|
@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,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.