Skip to content

Promise.timeout() leaks a promise reference after resolution/rejection #371

@henryptung

Description

@henryptung

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions