Polaris http requests hang when retrieved from client #177
Description
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 |