uWebSockets icon indicating copy to clipboard operation
uWebSockets copied to clipboard

Improved http timeout logic

Open ghost opened this issue 6 years ago • 3 comments

keepAliveTimeout should be low 10 seconds streamTineout should be high 300 seconds

They should be settable in App constructor

onData streaming should have timeout and should always end with isLast immediately if there is no data

ghost avatar Feb 21 '19 09:02 ghost

It can also be measured in lowest allowed throughput like kbps limit

ghost avatar Apr 06 '20 00:04 ghost

If these are passed in App constructor they will surely require an API break so v19

ghost avatar Jan 23 '21 19:01 ghost

It is not really about whether these are configurable or not, it is about the current logic being sometimes problematic. There is a fix timeout of 10 seconds for every chunk which works in most cases but can be very problematic if chunks written to kernel are HUGE. Timeout should scale with number of bytes written to kernel, to keep timeouts sane in all cases.

ghost avatar Jan 26 '21 11:01 ghost

On the writing side the problem is in favor of the server (slow receiving clients will get disconnected) because the kernel only emits writable events in large chunks.

On the reading side (posting a file to the server), the problem is in favor of the client - the client can send 1 single byte every 10 seconds and keep the connection open for as long as it wants. This can be a problem and here there needs to be a minimum number of bytes per 10 seconds that needs to be received.

I'm setting a default of 16kb/sec as lowest allowed receive throughput for now.

uNetworkingAB avatar Sep 25 '22 13:09 uNetworkingAB