partyserver: with hibernation off, a client close without a status code (1005) is never answered, so the client stays in CLOSING
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 69/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- networking
调研方向
首先阅读 closeQuietly 的实现和 #394 中的更改;issue 指明了保留的关闭代码,并提供了使用 hibernate: false 的复现方法。复现不带代码的关闭,并在 6 秒后检查 socket 状态。然后验证修复后客户端会收到 Close 帧并离开 CLOSING。
由索引模型根据 Issue 内容生成。
描述
Since #394, closeQuietly skips the reply for the reserved codes 1005, 1006 and 1015. 1006 and 1015 mean that no Close frame arrived. 1005 does not: it is what the server reports when the client sent a real Close frame with an empty body, which is what ws.close() with no arguments does. The transport is still open, and the client waits in CLOSING for the server's Close frame.
On a non-hibernating server (static options = { hibernate: false }) that frame never comes. y-partyserver's provider calls ws.close() with no code in disconnect(), so every YProvider.disconnect() ends this way. The provider keeps wsconnected === true until the socket finally dies, and a connect() in the meantime does nothing.
The #394 notes say compatibility dates on or after 2026-04-07 auto-reply to Close frames. That does not happen for these sockets: the result below is on compatibility date 2026-11-01.
Repro (wrangler 4.159.0, workerd 1.20261109.1, partyserver 0.5.10, y-partyserver 2.2.0, compatibility date 2026-11-01, hibernate: false):
- Start a
YServersubclass withhibernate: false(for example viaunstable_startWorker). - Open a raw WebSocket to
/parties/<party>/<room>, wait foropen, then callws.close()with no code. - With the stock
onClose, the client is still in readyState 2 (CLOSING) after 6000 ms. - Add
if (code === 1005) connection.close(1000, 'Closed')toonClose. The close completes in 14 ms and the client sees 1000.
In our production Worker that reply has run on every pause, reload and tab close since 2026-11-09. wrangler tail during a test run (57 events) showed no exceptions and no Network connection lost rejections.
Suggested fix: in closeQuietly, skip the reply only for 1006 and 1015. For 1005, reply with ws.close() (no code) or with 1000. A peer that sent a code-less Close frame is still there to receive the answer.
- 主要语言
- TypeScript
- 星标
- 1.3k
- 派生
- 84
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cloudflare/partykit 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
cloudflare/partykit#430 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
cloudflare/partykit#428 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
cloudflare/partykit#425 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
cloudflare/partykit#424 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
cloudflare/partykit#423 ·
查看 cloudflare/partykit 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
mcp: create_app refuses the Assistant Inbox spec as 'looks like an API key' (nesting deeper than 8)未关闭agent:claude agent:ready dogfood type:bug
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
opennextjs/opennextjs-cloudflare#1485 ·
维护者通常 1 天内回复
-
enhancement lane: fast tier: should-stable
难度 2/5 1-3 小时 新手友好度 76/100
unicef/adt-studio#1078 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
WenyuChiou/agent-board#1283 ·
维护者通常 1 天内回复