Skip to content

πŸ› Bug Report β€” Durable Objects with hibernatable WebSockets fail to hibernate when two connections are established near-simultaneouslyΒ #6862

Description

@apeacock1991

What we're seeing

When a Durable Object accepts two hibernatable WebSockets that are opened at nearly the same time, the DO never hibernates, even after all activity stops and the eviction timer elapses. The connection remains "active" indefinitely.

A single hibernatable WebSocket connection hibernates as expected; the problem only appears when two (or more) upgrades race to be delivered to the same DO before the first has finished being set up.

Impact

  • Affected DOs never enter hibernation, defeating the purpose of hibernatable WebSockets

Repro

  1. Deploy a DO that accepts hibernatable WebSockets via state.acceptWebSocket(ws).
  2. Open two WebSocket connections to the same DO instance at essentially the same moment.
  3. Stop all activity and wait past the hibernation/eviction timeout.
  4. Observe the DO does not hibernate; the first connection stays "open"/active and its wall time keeps increasing.

Expected: once both connections are idle, the DO should hibernate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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