PowerShell hangs when exiting having used a PowerShell runspace pool/runspace
See original GitHub issuePowerShell Core hangs when exiting and using a PowerShell runspace pool. On Windows PowerShell it exits successfully.
Steps to reproduce
here’s the gist for my code: https://gist.github.com/tylerl0706/2d87a13c6147278bb4e8565585aa9722
Steps:
PS > Add-Type -Path "path/to/TestHttpListener/bin/Debug/netstandard2.0/TestHttpListener.dll"
PS > $app = [TestHttpListener.TestHttpListener]::new()
PS > $app.Start(8081)
PS > Invoke-WebRequest -Uri http://localhost:8081 # VERY IMPORTANT
PS > exit
Expected behavior
PowerShell successfully exists
Actual behavior
PowerShell hangs and doesn’t give the prompt back - this is causing my AppVeyor and Travis builds to fail due to timeout 😦
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-beta.8
PSEdition Core
GitCommitId v6.0.0-beta.8
OS Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (11 by maintainers)
Top Results From Across the Web
WPF runspace crashes using powershell version 2
So I create two runspaces, one that creates and shows the WPF gui and the other one executes my install script. That works...
Read more >Exit foreground script Powershell: script hangs and Ctrl+C ...
It connects, reads the stream, writes to file, but does not exit. I then try to use Ctrl+C and it does not work....
Read more >Why does PsExec hang after successfully running a ...
No matter what I do, it hangs until I the locally on the cmd prompt. After I hit enter, I get the message:...
Read more >PowerShell script not exiting after completion
I have a question: I am using PowerShell to install Bentley ProjectWise Explorer via MDT. It works perfectly when run via a batch...
Read more >PowerShell 64-bit hanging on new machine
PowerShell 5.1.17763.316 and PowerShell Core 6.1.1; I have plenty of memory left (>16GB) and CPU is near idle while it's hanging. Only Windows ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@anmenaga, We really need to be able to depend on the CLR to work as advertised. We have other places in the code that relies on the finalizer to work. I’ll investigate more and if this looks like a CLR regression I’ll notify the team.
But for the short term I’ll create a workaround to fix this particular hang problem for RC using our existing cleanup on exit code.
I think I have a simpler repro without using httplistener