cinderblocks / libremetaverse

An fork of the libopenmetaverse library striving for performance improvements and up-to-date compatibility with Second Life and OpenSimulator (such as it is)
BSD 3-Clause "New" or "Revised" License
61 stars 44 forks source link

What's a good value for ServicePoint.MaxIdleTime in DownloadManager.SetupRequest? #62

Closed alexiscatnip closed 2 years ago

alexiscatnip commented 2 years ago

In DownloadManager.SetupRequest(), does it make sense to change request.ServicePoint.MaxIdleTime = 0; to request.ServicePoint.MaxIdleTime = Timeout.Infinite; or maybe change it to the value used for CapsBase: request.ServicePoint.MaxIdleTime = 60 * 1000;

I am running the library on Unity editor in windows, and my main thread blocks if this value is set to 0. (the debugger will enter BeginGetResponse() and staying there for minutes, accumulating RAM and eventually even blue screening my pc) On the other hand, both 60*1000 and Infinite are ok in my testing.

I will do more testing and confirm what's causing this issue and if its unity specific. Even if the underlying runtime/compiler interpret the 0 as literally '0 seconds' (instead of infinite). BeginGetResponse() should not be blocking UI thread, i think.

alexiscatnip commented 2 years ago

btw the timeout.Infinite value is taken from https://docs.microsoft.com/en-us/dotnet/api/system.net.servicepoint.maxidletime?view=net-6.0

cinderblocks commented 2 years ago

I honestly don't know why it's being set to zero there. Not sure if they meant to set Infinite. The comment mentions 60 seconds, so that's what I'm setting it at. Will be updated in 1.9.19