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
- Deploy a DO that accepts hibernatable WebSockets via state.acceptWebSocket(ws).
- Open two WebSocket connections to the same DO instance at essentially the same moment.
- Stop all activity and wait past the hibernation/eviction timeout.
- 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.
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
Repro
Expected: once both connections are idle, the DO should hibernate.