Skip to content

Discuss out-of-memory etc. agent cluster killing, especially for shared workers? #11205

@domenic

Description

@domenic

What is the issue with the HTML Standard?

Currently, the HTML Standard does not really discuss the fact that operating systems or browser implementations can kill processes, e.g. due to memory pressure. (The closest I can find is the killing scripts section.)

@yoshisatoyanagisawa is especially concerned about the case of implementing shared workers on Android, which has an OS-level OOM-killer. Under memory pressure, it would be very possible for a shared worker to be OOM-killed, while its clients are left alive. This could be confusing for developers.

My perspective is that this is kind of fine. Under memory pressure, I am sure many things get messed up. Your service worker might die. Your shared worker might die. Other Window clients you were communicating with via BroadcastChannel or storage APIs might die. But maybe this is something we should make explicit in the spec.

We could also use this opportunity to ask browsers to ensure that entire agent clusters get killed at one time, and they do not kill single agents within that agent cluster. If I recall correctly, this was one of the original motivations behind the design of agent clusters. But, it was never specified.

Alternately, if people believe that a shared worker spontaneously dying would be very bad, we could discuss more dramatic models, such as attempting to require that implementations kill all clients at the same time as they kill the shared worker. I am doubtful that this is a good idea though.

I'm especially curious if folks from WebKit and Gecko, which already implement shared workers on mobile devices, have any perspectives here. IIRC @asutherland is one person to tag here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: agentThe interaction with JavaScript's agent and agent cluster conceptstopic: workers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions