Polaris http requests hang when retrieved from client
suglasp opened this issue · 4 comments
Polaris Bug Report
Description of the bug
Running Powershell Core 6.1.1 on CentOS Linux ("CentOS Linux release 7.6.1810 (Core)")
Installed powershell core from ms repo and did a Install-Module Polaris.
Eventually after running into problems, started off to Install-Module -Scope CurrentUser Polaris for debugging and troubleshooting.
Tested same problem with v0.1.0 and 0.2.0 module versions.
A clear and concise description of what the bug is.
Steps to reproduce
SSH Session #1:
Import-Module Polaris
New-PolarisGetRoute -Path '/helloworld' -Scriptblock { $Response.Send("Hi"); return }
Stop-Polaris; Start-Polaris -Port 8080
SSH Session #2:
Invoke-RestMethod -Method GET -Uri http://machine:8080/helloworld -Verbose
VERBOSE: GET http://machine:8080/helloworld with 0-byte payload
--> // hangs here
SSH Session #1:
had to stop-polaris. Got no response at all in Browser or in session #2
So went troubleshooting. Seems in first place the $Polaris.Log() statements are blocking the I/O.
SSH Session #1:
$env:PSModulePath
/username/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/opt/microsoft/powershell/6/Modules
cd /usr/local/share/powershell/Modules/Polaris/0.2.0/lib
edited file Polaris.Class.ps1 and commented all line statements with "$Polaris.Log(" ...
Stop-Palaris
Remove-Module Polaris
Remove-Module Polaris.Class
Import-Module Polaris
New-PolarisGetRoute -Path '/helloworld' -Scriptblock { $Response.Send("Hi"); return } -Force
Start-Polaris -Port 8080
SSH Session #2:
Invoke-RestMethod -Method GET -Uri http://machine:8080/helloworld -Verbose
VERBOSE: GET http://machine:8080/helloworld with 0-byte payload
--> // hangs here (again)
Now, when i go to session #2 and do Stop-Polaris or Ctrl+C then it gives response in session #2:
VERBOSE: received 2-byte response of content type text/plain
VERBOSE: Content encoding: iso-8859-1
Expected behavior
Return me a value instant
Add any other context about the problem here.
Version Information
tested behaviour with Polaris v0.1.0 and v0.2.0
Name | Version |
---|---|
Polaris | 0.2.0 |
WSManStackVersion | PSVersion | PSEdition | PSCompatibleVersions | Platform | GitCommitId | OS | PSRemotingProtocolVersion | SerializationVersion |
---|---|---|---|---|---|---|---|---|
3.0 | 6.1.1 | Core | 1.0.-1.-1, 2.0.-1.-1, 3.0.-1.-1, 4.0.-1.-1, 5.0.-1.-1, 5.1.10032.0, 6.1.1.-1 | Unix | 6.1.1 | Linux 3.10.0-957.1.3.el7.x86_64 #1 SMP Thu Nov 29 14:49:43 UTC 2018 | 2.3 | 1.1.0.1 |
Hi suglasp,
Sounds very similar to a known issue we have on Unix based platforms (OSX / Linux) detailed more in #136, could you try the following before running Polaris and see if the issue clears up for you:
Remove-Module PSReadline
(Not meant as a fix, just wanting to narrow the issue down)
Thanks for the detailed bug report!
Works if i do this.
I noticed before (because i came across the 136 issue), i have to do the Invoke-RestMethod in a second ssh tty or it hangs if i try to run it from the same tty where i execute the Start-Polaris CmdLet.
[update] Works from a browser to now, gets instant response.
I am also experiencing this isssue - removing PSReadline also resolves the issue for me. Thanks for the workaround @Tiberriver256
Closing as we are tracking this issue in #136