Since timeout() uses window.setTimeout() but does not clearTimeout() on resolution/rejection, a handle to the promise (and its resolution data) is leaked in the window for the duration of the timeout, even if the request is rapidly resolved. When the rate of data transfer is very high, this causes the browser to OOM and crash within minutes.
We use promises in the context of requests that have a vastly variable range of latency and transfer speed (between milliseconds and tens of minutes) due to unpredictable network/operational conditions. Promise.timeout() can handle this with a sufficiently large timeout setting, but this causes problems under very low latency conditions.
The text was updated successfully, but these errors were encountered:
Since timeout() uses window.setTimeout() but does not clearTimeout() on resolution/rejection, a handle to the promise (and its resolution data) is leaked in the window for the duration of the timeout, even if the request is rapidly resolved. When the rate of data transfer is very high, this causes the browser to OOM and crash within minutes.
We use promises in the context of requests that have a vastly variable range of latency and transfer speed (between milliseconds and tens of minutes) due to unpredictable network/operational conditions. Promise.timeout() can handle this with a sufficiently large timeout setting, but this causes problems under very low latency conditions.
The text was updated successfully, but these errors were encountered: