Closed punk88 closed 8 months ago
Thanks for the report! I've been able to reproduce the issue.
When release of package will be available with this fix?
I don't have concrete plans for a release at the moment. You should be able to grab nuget packages from CI (e.g. https://dotnet.visualstudio.com/IronLanguages/_build/results?buildId=101933&view=results) if you need the fix right away...
Description
Script hangs on read reasponse via http.client.HTTPSConnection.
Steps to Reproduce
I have script that send https request and read its response via http.client module:
Expected behavior:
Script is executing without problems
Actual behavior:
Under certain conditions(which i describe below) script hang on line
response = conn.getresponse()
Version Information
3.4.1
Additional information
I got this promplem under certain conditions, when response size is multiple of 2048 bytes
Stack trace on script hangs:
In my opinion, problem in code in _ssl.cs on method read():
_sslStream initialization:
This code read data from NetworkStream(inside SslStream) in cycle(while) of 2048 bytes. When whole response size is multiple of 2048 bytes(in my case I got this problem on response size 4096 bytes) then
_sslStream.Read(buf, 0, readLength)
hangs. This known behavior of NetworkStream.Read() blocks until data becomes available or the connection is closed. See https://stackoverflow.com/a/6958290 and another issues. So, in my case I have 3 iterations: read 2048 bytes, read 2048 bytes, and read 0 bytes expected where I hangs.Workaround in scripts for this problem is use header 'Connection': 'close' instead default 'keep-alive', so with 'close' server close connection and cycle in code ends. But need a solution without this hardcode in scripts