Repository navigation
Conversation
- retireChild 发 shutdown 前不再判 connected:rpc 对未连接的子进程本来就立即拒绝, 调用方传进来的总是当前子进程。 - waitExit 只补上 signalCode 的判断,其余回到原写法。 - init 失败的处理改用 .catch,init 请求体不再整段换行。 - 两条归属测试挪进 proxy.test.ts,复用 FakeHost,按该文件的排版写。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- 重启时 spawn 失败而 this.child 仍在(旧引擎 kill 后 5 秒还没退出,或已有受管引擎), 不会再排重启,日志原来照样写「继续重试」。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
谢谢修复,问题和改法都对。我们在你的分支上追加了两个提交:去掉了几处多余的判断( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
中文
Minecraft 引擎子进程的 init RPC 超时后,重连只丢掉了子进程引用,没有结束那个进程,接着 fork 一个新的。旧进程还连着服务器,和新进程抢同一个账号;它之后的消息和退出回调还会清掉新进程的状态。
现在 init 失败和停机走同一个
retireChild:先发 shutdown,等 5 秒,没退出就 kill 再等 5 秒,确认退出后才重试。消息和退出回调只认发出它们的那个子进程,已有受管子进程时spawn直接报错,有意结束的子进程不触发重启。代价:kill 之后 5 秒仍没退出时不再排重启,日志写「旧引擎没有退出,不再重启」,这个 World 停在没有引擎的状态,旧进程退出后要手动重启这个 World。验证:
pnpm test(287 个文件,5184 条通过,3 条跳过)与pnpm run typecheck通过;tests/worlds/minecraft/proxy.test.ts的两条归属测试在改动前的proxy.ts上失败、改后通过。没有连真实 Minecraft 服务器验证;作者在 0.2.11 的直播部署上验证过,账号从两个抢占的引擎恢复成一个。English
When the Minecraft engine's initialization RPC times out, a reconnect previously discarded the child reference without terminating that process. A replacement could then compete with the still-connected child for the same account. Late messages and exit callbacks from the old child could also clear the replacement's state.
Retire and await the exact owned child before retrying, bind callbacks to their originating process, and refuse concurrent spawns. Shutdown and initialization failure share one retirement promise; an intentional retirement cannot schedule another reconnect. This adds no server rules or alternate game loop.
Validation: complete official-main suite (5,184 passed, 3 skipped), TypeScript checks, and real fork/IPC regression tests. The same ownership fix was separately validated on the retained 0.2.11 consumer (5,197 passed, 3 skipped) and restored a live account from two competing children to one authenticated engine.