Skip to content

fix(gateway): wake a sandbox on disk again - #385

Merged
WaylandYang merged 1 commit into
devfrom
fix/gateway-wake-from-disk
Oct 30, 2026
Merged

WaylandYang merged 1 commit into
devfrom
fix/gateway-wake-from-disk

Conversation

@WaylandYang

Copy link
Copy Markdown
Contributor

问题

落盘(Snapshot 档位)的沙箱收到请求时,gateway 直接回 502,沙箱再也不会被唤醒。

舰队流量测试(每节点 40 个 app64,1-8 req/s)里 67-79% 的请求失败,而 872682b 是 1-2.5%。

原因

落盘沙箱没有 namespace,它的地址落在节点的 unreachable 兜底路由上,连接返回 No route to host。872682b 的 gateway 遇到任何连接错误都会唤醒;#365 改成了只在 ConnectionRefused 时唤醒,这种情况就成了 502。net.rs 的注释仍然写着 gateway 会把它当成冷沙箱,但没有测试覆盖。

修复

新增 proxy::is_cold:refused(冻结沙箱,#327 的 REJECT)或没有路由(落盘沙箱)都算冷,gateway 全部改用它。E2B 入口(front.rs)保持 is_refused:那里连的是节点,不可达说明节点有问题,不是沙箱睡着了。

验证

  • 新增单元测试 a_sandbox_on_disk_is_cold。真实的"无路由"需要 root 才能造出来,所以测的是错误分类。
  • 在舰队节点 f3 上实测:沙箱闲置 80 秒到 snapshot 档位后发请求,返回 200,152 ms,其中唤醒 138 ms。修复前同样的请求是 0.8 ms 的 502。
  • 完整的舰队套件正在这个版本上重跑。

🤖 Generated with Claude Code

A sandbox on disk has no namespace, and its address falls on the node's
unreachable floor, so a connection to it fails with "no route to host".
The gateway took that as cold and woke it until #365, which woke only on a
refusal; since then every request to a sandbox on disk was answered 502
at once and the sandbox was never woken. In the fleet's traffic runs that
was 67-79% of requests, against 1-2.5% at 872682b.

The gateway now wakes on a refusal or on no route (proxy::is_cold). The
E2B front door keeps is_refused: there an unreachable address is a node
that cannot be reached, not a sandbox asleep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@WaylandYang
WaylandYang merged commit 62555cb into dev Oct 30, 2026
10 checks passed
@WaylandYang
WaylandYang deleted the fix/gateway-wake-from-disk branch October 30, 2026 08:15
WaylandYang added a commit that referenced this pull request Oct 30, 2026
The figures and tables measured before #376, #380 and #385 go, the capacity
headline with them until the fills are rerun. bench/fleet/results/2026-10-30
holds the traffic, wake, herd and wall runs on the six nodes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WaylandYang added a commit that referenced this pull request Oct 30, 2026
…-30 results (#388)

* bench: start times on the six 2-core, 2 GB nodes with the new build, replacing the one-VM table

Every runtime started one at a time on each of six cloud nodes, the median
of their p50s, drawn by bench/baremetal/charts.py. charts.py for the fleet
now reads a round's layout from its builds.json, so a new round can be
drawn without renaming its directories; 2026-10-28 draws unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(readme): badges as files in the repo, and the backend described as each node's own

GitHub's image proxy would not show the shields.io badges with an embedded
logo; the same SVGs are now in docs/assets/badges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(readme): shorter, one chart, and only numbers from this round

The figures and tables measured before #376, #380 and #385 go, the capacity
headline with them until the fills are rerun. bench/fleet/results/2026-10-30
holds the traffic, wake, herd and wall runs on the six nodes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(readme): console screenshots of the current console

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant