2026年9月9日,Cloudflare 通知我们,在其 Workers AI 上的 GLM-5.3 部署中存在跨请求的 KV cache 泄露问题。我们与 Cloudflare 合作解决了涉及请求拒绝路径的问题,并加强了在分离式服务(disaggregated serving)中相关的缓存生命周期处理。
我们正与 Cloudflare 以及通过 Cloudflare 的 HackerOne 计划报告该问题的研究人员协调发布此披露信息。Cloudflare 的报告涵盖了其生产事故及客户影响,而研究人员的报告(即将发布)将描述发现过程及外部验证结果。本文重点介绍底层机制、我们所做的更改以及对 SGLang 运营者的指导。
在此阅读 Cloudflare 的报告。
影响范围及受影响的部署
Cloudflare 报告称,该事故影响了 2026年8月27日至9月9日期间 Workers AI 上的 @cf/zai-org/glm-5.3。其调查未发现其他 Workers AI 模型受到影响。
Cloudflare 的调查发现,超出预填充(prefill)KV cache 容量的请求可能会返回来自另一用户会话的内容。有关事故范围和客户影响的详细信息,请参阅 Cloudflare 的事故报告。
该问题发生在分离式预填充/解码服务中,其中不同的工作进程分别处理提示词并生成响应。单节点拒绝路径则返回错误。
事件经过
Cloudflare 的部署配置上下文长度为 1,048,576 个 token,但其预填充 KV cache 池仅能容纳 681,280 个 token。因此,请求可能符合配置的上下文窗口大小,却超出了处理它所需的内存容量。
在 SGLang 的分离式预填充/解码路径中,被标记为拒绝的请求仍可能通过交接流程继续执行。解码阶段随后可能会读取尚未为该请求填充的缓存页。这种配置不匹配使得拒绝路径得以触发。下文所述的准入修复措施确保被拒绝的请求在进入分离式交接之前返回错误。它补充了部署层面的检查机制,用于比较池容量与配置的上下文长度。
Cloudflare 于9月9日禁用了该模型的公共访问权限。它扩大了预填充池以容纳配置的上下文窗口,并部署了由 Cloudflare 编写的引擎补丁,以便对拒绝的请求返回错误。Cloudflare 报告称,它在当晚恢复模型之前,针对研究人员的复现结果及其自身的金丝雀标记测试验证了这些更改。
上游修复 #36988 在处理最终预填充结果时终止已中止的请求。后续更改 #38935 在请求进入分离式交接之前更早地停止接收被拒绝的请求,从而避免不必要的工作和延迟。
除了准入修复外,我们还与 Cloudflare 合作探讨了 SGLang 如何处理请求中断时的 KV cache 传输。
在预填充-解码(PD)分离式服务中,中止的请求仍可能有 RDMA 写入操作正在飞行中。如果解码阶段在这些写入完成之前释放并重新分配目标槽位,延迟的写入可能会覆盖另一个请求的 KVCache 并损坏其输出。
Cloudflare 的报告还描述了我们在相关 KV cache 生命周期问题上的联合工作。以下部分将解释延迟释放机制、额外的传输安全措施以及完整性检查,同时包括我们的验证结果和对运营者的指导。
背景
在 PD 分离式服务中,预填充和解码阶段在独立的引擎上运行,每个请求的 KVCache 必须从预填充引擎移动到解码引擎的内存池中。为了性能考虑,此传输是异步进行的。Mooncake、NIXL 或 MORI 等传输引擎将其作为单向 RDMA WRITE 操作发出,在预填充计算仍在进行时,将 KVCache 块流式传输到预保留的目标槽位中。
由于传输是异步的,请求可能会在部分写入仍在飞行中时终止。预填充(Prefill)随后可以丢弃其软件队列中等待的块,但无法停止它已启动发往目的地的写入,例如此时正在进行的块。在早期的实现中,当请求在传输中途终止(客户端断开连接、超时或传输故障)时,解码器(Decode)会在终止时将目的地槽位返回给分配器,而不等待此类写入完成。如果分配器在写入到达之前重新分配了这些槽位,已终止请求的 KVCache 就会落入另一个请求的 KVCache 中。在典型的工作负载中,这种损坏很少见,尽管长上下文使其可能性大大增加(见下文事实 4)。每次发生都是静默的。传输报告成功,没有任何组件抛出异常或记录错误。一个被污染的槽位会导致整个生成过程崩溃,因为注意力机制会读取每一个位置。
因此,一个要求模型从 1 数到 15 的请求,返回的是一串不连贯且无关的 token 流。随后,我们着手使这种竞态条件能够按需复现,并从传输引擎层到服务引擎层进行端到端的修复。
问题:KVCache 槽位何时真正空闲?
该故障分为四个步骤:
客户端断开连接、准入拒绝或传输故障在至少一个已启动的写入尚未到达时中止请求 A。
解码器在中止时释放 A 的 KVCache 槽位。分配器将这些槽位标记为空闲,而远程写入者仍在向它们写入。
分配器将这些槽位交给受害者请求 B。
A 的已启动写入落在 B 的 KVCache 内部,B 使用外部的键和值进行解码,且没有任何错误。
这些步骤适用于任何通过异步 DMA、推送或拉取在引擎之间移动 KVCache 的 PD(Prefill-Decode)实现,因为每一个都需要决定何时槽位是空闲的。我们在 SGLang 中诊断并修复了这一类问题。
图 1:竞态条件。中止操作释放了 A 的槽位,而 A 的已启动写入仍在到达;B 继承了这些槽位,迟到的写入落在了其 KVCache 内部。
系统的四个事实使得每个步骤成为可能。
分配器可以在针对某槽位的写入仍在飞行时将其标记为空闲。在 PD 分离架构中,解码引擎为每个传入请求预保留目的地 KVCache 槽位,其分配器跟踪这些槽位是已分配还是空闲。但“空闲”有第二个隐藏条件:只有当没有远程写入者还能触及该槽位时,才安全地重用该槽位。这类 bug 源于这两个定义之间的差距。每一个都是分布式的使用后释放(use-after-free),其中悬空指针是坐在另一台机器 NIC 队列中的写入请求。修复方案使第二个条件变得明确、可观察且有界。
已启动的 RDMA 工作无法取消,无论是推送还是拉取。SGLang 的 KVCache 传输是基于推送的 [3]。预填充将 KVCache 写入解码器的内存,因为预填充知道它产生每个块的时刻,可以按块地将传输与正在进行的计算重叠。在 NIC 层面及以下,在不损害可用性的情况下实现取消非常困难。RDMA API 没有调用可以取消已发布到 NIC 队列对的单个工作请求。Python 无法在中途中断传输引擎的阻塞 C++ 调用(例如 Mooncake 的 batch_transfer_sync)。如果该调用超时,其工作请求仍保持发布状态而无完成计数,因此这些写入可能会在未知的稍后时间到达。单向 RDMA WRITE 绕过了接收者的 CPU,因此解码器无法收到每个写入的信号以供其等待。NIC 也按数据包放置数据:在中途被中断的写入仍然会在目的地留下部分写入的前缀,因此即使是看似取消的路径也会修改目的地内存。
采用拉取(pull-based)设计也无法避免这一问题。如果解码端(decode)发出 RDMA READ 请求,那么在中途到达的中断信号会使解码端已发布的读取操作落入它刚刚释放的槽位中,因为已发布的 READ 与已发布的 WRITE 一样,都无法收回。在拉取模式下,风险还会以相反的方向蔓延:如果预填充端(prefill)在中断时释放其源页面,而分配器在 READ 仍在飞行途中时重新分配了这些页面,那么该读取操作会将另一个请求的 KVCache 拉取到解码端。先释放后重新分配的槽位会在传输的两端造成数据损坏。
图 2:Python 调度程序下方的传输栈。中断可以阻止未来的数据块,但所有已移交至 C++ 引擎或网卡的内容都无法撤回,且接收端的 CPU 根本看不到这些写入操作。
完整的活性(liveness)处理始于路由器,但不能止于路由器。只有当 P/D 对的双方都获悉中断时,中断才是安全的。设计良好的 PD 路由器会同时取消该对请求,从而避免任何一方等待一个永远不会到来的对等方的 300 秒超时。在 sgl-router 中,#41612 在 #39461 的断开连接即中断机制之上构建了 PD 配对逻辑。该对请求共享一个由路由器生成的请求 ID。客户端断开连接会导致解码端中断;预填充失败会丢弃解码端请求,从而使引擎对其进行中断;预填充端则通过解码端引擎侧的 ABORT 通知获悉中断。sgl-model-gateway 将这两个事件进行配对(#19524 用于断开连接,#29017 用于预填充失败)。在该引擎侧通知机制存在之前,仅中断单侧的路由器必然导致竞态条件:解码端释放了其槽位,而预填充端因未收到通知,继续推送数据。即使是最完美的路由器也只能缩小窗口。中断以异步方式到达预填充端,经过一定的调度和网络延迟后,传输引擎已经启动的任何操作(如飞行中的 C++ 调用、已发布的请求)仍会继续执行。路由器决定谁被中止(中断编排),而引擎决定内存何时安全(排空正确性)。
竞态窗口随预填充上下文长度而扩大。SGLang 将传输分块,并与预填充计算重叠,因此暴露窗口涵盖了预填充的大部分过程。短提示词在飞行中仅持续毫秒级。而对于 128K–1M token 的上下文,根据模型不同,每个 token 对应数十至数百 KB 的 KVCache,写入操作在飞行中的持续时间从数秒到数分钟不等,跨越多个数据块和多个已发布的请求。中断后的尾部效应随之增长。长上下文意味着更多数据块处于飞行状态,且在断中到达时,仍有更多请求正在排空,因此已启动的写入操作可能在分配器回收已释放槽位之后很久才落地。在内存压力下,中止长请求会导致“写后重用”成为预期结果。长上下文工作负载也是客户端在请求中途超时并断开连接的主要场景。长上下文因此同时扩大了窗口、延长了中断后的尾部效应并提高了中断率,使得此类 bug 随着部署向长上下文服务迁移而显现。
影响与暴露条件
此处描述的传输竞态需要满足三个条件:
启用了 PD 分离,并配置了 KVCache 传输后端(Mooncake、NIXL、MORI 或自定义的 CommonKVManager 后端)。没有此跨引擎传输路径的单实例部署不受此特定竞态的影响。
请求在传输中途终止(客户端断开连接、路由器取消、超时、传输故障、预填充失败或 hicache 恢复失败),且至少有一个写入操作已启动但尚未落地。
分配器在已启动的写入操作落地之前,将已释放的槽位重新分配给另一个请求,这在内存压力下仅需毫秒级即可完成。
移除三者中的任意一个,腐败(数据损坏)便无法发生。在 PD 部署中,默认配置受到影响的版本范围从 v0.4.x 系列(2025 年初,当时 PD 解耦随 RDMA 后端发布)开始,直到 v0.5.21,或对于 MORI 而言是 v0.5.22。一个具有相同特征码的独立变体需要解码侧的分层缓存卸载功能,该功能默认未启用(已通过 #24226 和 #30899 修复)。
确定性还是概率性?在生产环境中,竞争条件属于概率性事件,因此操作员看到的是偶尔出现且无法复现的数据损坏输出。一旦保持窗口开启,即可按需复现(下一节中的我们的测试工具,以及社区在 #32564 中提供的复现案例)。客户端可以通过发送长上下文请求并在传输中途断开连接来故意提高发生概率,这将最大化竞争窗口和中止率。客户端无法选择受害者或目标槽位,且数据流是单向的。被中止请求的 KVCache 落入另一个请求的 KVCache 中,没有任何数据回流至中止者。因此,实际影响是单向的请求间泄漏,即被中止请求的上下文片段可能会出现在另一个客户端的输出中,正如我们在复现中所见。中止者一无所获,但在多租户服务场景中,这既是一个数据泄露问题,也是一个完整性问题。
部署者能否判断暴露是否已经发生?部署者没有可靠的方法来判断,因为损坏不会留下任何错误或日志行。可选的 PD 校验和(#39500)可以捕获一些延迟写入(参见 PD Checksum)。升级后,使用 #41128 指标来确认保护机制正在生效(参见操作员推荐操作)。
确定性复现
在声称修复之前,我们需要复现该竞争条件,因此我们构建了一个测试工具,能够在 1P1D 对按需触发此问题。预填充(prefill)中 send_kvcache 内部的 env-gated 延迟使已发起的写入保持在传输中,--max-total-tokens 96 强制立即重用槽位,并且仪器记录每个请求的槽位范围以及每次释放或保持的决定。
在窗口保持开启的情况下,重叠每次都出现:解码器在写入仍在传输中时释放了请求 A 的槽位 [14..44],请求 B 分配了 [1..32],两个范围在 [14..32] 上发生碰撞。软件延迟无法使写入本身在单个 P/D 对上延迟落地,因为传输队列会对写入同一解码引擎的数据进行序列化。为了展示错误的输出(而不仅仅是重叠的槽位号),我们在受害者提交点将被中止请求释放的页面复制到重叠区域,这正是延迟写入所做的操作。在没有修复的情况下,受害者的输出是乱码。在修复后,解码器保留了捐赠者的槽位,受害者获得了新鲜槽位,输出与基线完全一致。
一旦两个预填充引擎共享一个解码器,真正的延迟落地也能在实时硬件上端到端复现,这样它们的写入就不会被序列化。我们在 2×H200 对(Mooncake over RDMA)上运行了该测试,并禁用了保持功能。单边中止释放了捐赠者的 430 个槽位,受害者在其中预分配了 [1..105],而捐赠者发起的写入在解码中途落地。受害者正确计数到 80,然后其输出变成了捐赠者的提示文本:另一个请求的 KVCache 被读回并用于生成。在启用保持功能且时序相同的情况下,解码器记录了 hold、drain-ack 和 release,受害者等待 release 后生成的输出与基线逐字节一致。完整的配方(测试工具补丁、启动脚本、驱动程序以及观察到的输出)位于一个公开的 gist 中。
修复方案:延迟 KVCache 释放
解码器无法取消预填充发起的写入,因此它将被中止请求的槽位保留的时间长于这些写入能够落地的时间:
T_hold > t_abort_propagation + t_remaining_chunks + t_in_flight_call
只有当该不等式在每一个中止路径上都成立时,此修复方案才是安全的。设计的其余部分确保每个中止路径都持有槽位(左侧),并对右侧的每一项进行边界约束(详见 #44186)。等待完成也符合硬件特性:可靠连接 RDMA 按顺序执行工作请求,因此“所有写入已排空”在发送端表现为对完成队列的单一观察结果。
延迟释放
我们通过三个步骤构建了该机制:
在中止时通知预填充阶段(#27372)。在解码侧的中止事件中,解码器向每个预填充等级发送 ABORT 消息,每个等级丢弃该软件队列中仍等待分配给该房间的所有块。这将 t_remaining_chunks 降至接近零。若无此通知,传输的剩余所有块都将启动并落地,因此该项覆盖了预填充阶段的其余全部时间。t_in_flight_call
On September 9, 2026, Cloudflare notified us of cross-request KV cache exposure in its GLM-5.3 deployment on Workers AI. We worked with Cloudflare to address the request-rejection path involved and strengthen related cache-lifetime handling in disaggregated serving.
We are publishing this disclosure in coordination with Cloudflare and the researcher who reported the issue through Cloudflare’s HackerOne program. Cloudflare’s report covers its production incident and customer impact, and the researcher’s report (available soon) will describe the discovery and external validation. This post focuses on the underlying mechanisms, the changes we made, and guidance for SGLang operators.
Read Cloudflare’s report here.
Impact and affected deployments
Cloudflare reports that the incident affected @cf/zai-org/glm-5.3 on Workers AI between August 27 and September 9, 2026. Its investigation found no other Workers AI model affected.
Cloudflare’s investigation found that requests exceeding the prefill KV cache capacity could return content from another user’s session. For details on the incident’s scope and customer impact, see Cloudflare’s incident report.
The issue occurred in disaggregated prefill/decode serving, where separate workers process the prompt and generate the response. The single-node rejection path returned an error instead.
What happened
Cloudflare’s deployment had a configured context length of 1,048,576 tokens, but its prefill KV cache pool could hold 681,280 tokens. A request could therefore fit the configured context window while exceeding the memory available to process it.
In SGLang’s disaggregated prefill/decode path, a request marked for rejection could still proceed through the handoff. Decode could then read cache pages that had not been populated for that request. The configuration mismatch made the rejection path reachable. The admission fix described below ensures that a rejected request returns an error before entering the disaggregated handoff. It complements deployment checks that compare pool capacity with the configured context length.
Cloudflare disabled public access to the model on September 9. It increased the prefill pool to accommodate the configured context window and deployed a Cloudflare-authored engine patch that returned errors for rejected requests. Cloudflare reports that it validated these changes against the researcher’s reproduction and its own canary-marker tests before restoring the model that evening.
The upstream fix, #36988 , retires aborted requests when their final prefill result is processed. Follow-up change #38935 stops intake-rejected requests earlier, before they enter the disaggregated handoff, avoiding unnecessary work and delays.
Alongside the admission fix, we worked with Cloudflare on how SGLang handles KV cache transfers when requests are interrupted.
In prefill-decode (PD) disaggregated serving, an aborted request can still have RDMA writes in flight. If decode releases and reassigns the destination slots before those writes complete, the late writes can overwrite another request’s KVCache and corrupt its output.
Cloudflare’s report also describes our joint work on related KV cache lifetime issues. The following sections explain the deferred-release mechanism, additional transfer safeguards, and integrity checks, along with our validation results and guidance for operators.
Background
In PD-disaggregated serving, the prefill and decode phases run on separate engines, and each request’s KVCache must move from the prefill engine into the decode engine’s memory pool. For performance, this transfer is asynchronous. Transfer engines such as Mooncake, NIXL, or MORI issue it as one-sided RDMA WRITE operations that stream KVCache chunks into pre-reserved destination slots while prefill computation is still in progress.
Because the transfer is asynchronous, a request can die while some of its writes are in flight. Prefill can then drop the chunks still waiting in its software queues, but it cannot stop a write it has launched toward the destination, such as the chunk in progress at that moment. In earlier implementations, when a request terminated mid-transfer (a client disconnect, a timeout, a transport fault), decode returned its destination slots to the allocator at termination, without waiting for such a write to finish. If the allocator reassigned the slots before the write landed, the dead request’s KVCache landed in another request’s KVCache. In typical workloads the corruption was rare, although long contexts make it far more likely (see fact 4 below). Each occurrence was silent. The transfer reported success, and no component raised an exception or logged an error. A single contaminated slot derails an entire generation, because attention reads every position.
As a result, a request asking the model to count from 1 to 15 comes back as an incoherent stream of unrelated tokens. We then set out to make the race reproducible on demand and to fix it end to end, from the transfer engine layer up to the serving engine.
The Problem: When Is a KVCache Slot Actually Free?
The failure takes four steps:
A client disconnect, an admission rejection, or a transfer fault aborts request A mid-transfer while at least one launched write has not yet landed.
Decode frees A’s KVCache slots at abort time. The allocator marks them free while the remote writer is still writing to them.
The allocator hands those slots to victim request B.
A’s launched writes land inside B’s KVCache, and B decodes on foreign keys and values with no error.
These steps apply to any PD implementation that moves KVCache between engines with asynchronous DMA, push or pull, because each one has to decide when a slot is free. We diagnosed and fixed the family in SGLang.
Figure 1: The race. The abort frees A’s slots while A’s launched writes are still landing; B inherits the slots and the late writes land inside its KVCache.
Four facts about the system make each step possible.
The allocator can mark a slot free while writes to it are in flight. In PD disaggregation, the decode engine pre-reserves destination KVCache slots for each incoming request, and its allocator tracks them as allocated or free. But “free” has a second, hidden condition: A slot is safe to reuse only when no remote writer can still touch it . The bugs in this class come from the gap between these two definitions. Each one is a distributed use-after-free, where the dangling pointer is a write request sitting in a NIC queue on another machine. The fix makes the second condition explicit, observable, and bounded.
Launched RDMA work cannot be cancelled, for push and pull alike. SGLang’s KVCache transfer is push-based [3]. Prefill writes KVCache into decode’s memory, because prefill knows the moment it produces each chunk and can overlap transfer with ongoing computation, chunk by chunk. At and below the NIC, cancellation is hard to achieve without hurting availability. The RDMA API has no call that cancels an individual work request already posted to the NIC’s queue pair. Python cannot interrupt the transfer engine’s blocking C++ call (e.g., Mooncake’s batch_transfer_sync ) mid-call. If that call times out, its work requests stay posted with no completion accounting, so those writes may land at an unknown later time. One-sided RDMA WRITE bypasses the receiver’s CPU, so decode gets no signal for each write that it could wait on. The NIC also places data per packet: A write interrupted mid-flight still leaves a partially written prefix at the destination, so even the paths that look like cancellation can mutate destination memory.
A pull-based design would not escape this. If decode issued RDMA READs instead, an abort arriving mid-pull would leave decode’s own posted reads landing in slots it just freed, because a posted READ is as impossible to take back as a posted WRITE. Under pull, the hazard also runs the other way: If prefill frees its source pages at abort time and the allocator reassigns them while a READ is still in flight, that read fetches another request’s KVCache into decode. Freed-then-reassigned slots corrupt the transfer at either end.
Figure 2: The transfer stack below the Python scheduler. An abort can stop future chunks, but everything already handed to the C++ engine or the NIC is beyond recall, and the receiving CPU never sees the writes at all.
Complete liveness handling starts at the router but cannot end there. An abort is only safe when both halves of a P/D pair learn about it. A well-designed PD router cancels the pair together, so neither side waits out a 300-second timeout for a peer that is never coming. In sgl-router , #41612 builds the PD pairing on top of the abort-on-disconnect of #39461 . The pair shares one router-minted request id. A client disconnect aborts decode, a prefill failure drops the decode request so the engine aborts it, and prefill learns of the abort through decode’s engine-side ABORT notification. sgl-model-gateway pairs the same two events ( #19524 for disconnects, #29017 for prefill failures). Before that engine-side notification existed, a router that aborted only one side guaranteed the race: Decode released its slots while prefill, never told, kept pushing. Even a perfect router only narrows the window. The abort reaches prefill asynchronously, after some scheduling and network delay, and whatever the transfer engine already launched (an in-flight C++ call, posted work requests) continues regardless. The router decides who dies (abort orchestration), and the engine decides when memory is safe (drain correctness).
The race window scales with prefill context length. SGLang chunks transfers and overlaps them with prefill computation, so the exposure window spans much of the prefill itself. A short prompt is in flight for milliseconds. A 128K–1M-token context, at tens to hundreds of kilobytes of KVCache per token depending on the model, keeps writes in flight for seconds to minutes, across many chunks and many posted work requests. The tail after the abort grows with it. A long context means more chunks in flight and more work requests still draining at the moment the abort lands, so launched writes can keep landing well after the allocator has reclaimed the freed slots. Under memory pressure, aborting a long request makes a write-after-reuse the expected outcome. Long-context workloads are also the ones where clients time out and disconnect mid-request. Long contexts therefore widen the window, lengthen the post-abort tail, and raise the abort rate all at once, so this bug class surfaces as deployments move to long-context serving.
Impact and Exposure
The aborted-transfer race described here requires three conditions:
PD disaggregation is enabled with a KVCache transfer backend (Mooncake, NIXL, MORI, or a custom CommonKVManager backend). A single-instance deployment without this cross-engine transfer path is not affected by this specific race.
A request terminates mid-transfer (client disconnect, router cancel, timeout, transport fault, prefill failure, or hicache restore failure) while at least one of its writes is launched and not yet landed.
The allocator reassigns the freed slots to another request before the launched writes land, which under memory pressure happens in milliseconds.
Remove any one of the three and the corruption cannot occur. Within PD deployments, default configurations were affected from the v0.4.x line (early 2025), when PD disaggregation shipped with RDMA backends, until v0.5.21, or v0.5.22 for MORI. A separate variant with the same signature required decode-side hierarchical cache offload, which is not on by default (fixed by #24226 and #30899 ).
Deterministic or probabilistic? In production the race is probabilistic, so operators saw occasional corrupted outputs that they could not reproduce. Once the window is held open, it reproduces on demand (our harness in the next section, and the community reproducer in #32564 ). A client can raise the odds on purpose by sending long-context requests and disconnecting mid-transfer, which maximizes the race window and abort rate. The client cannot choose the victim or the landing slots, and the flow runs one way. The aborted request’s KVCache lands in another request’s KVCache, and nothing flows back to the aborter. The realistic impact is therefore one-way cross-request leakage, in which fragments of the aborted request’s context can surface in another client’s output, as they did in our reproduction. The aborter learns nothing, but in multi-tenant serving this is a data-leakage concern as well as an integrity one.
Can a deployer tell whether exposure already occurred? A deployer has no reliable way to tell, because the corruption leaves no error or log line. The opt-in PD checksum ( #39500 ) can catch some late writes (see PD Checksum). After upgrading, use the #41128 metrics to confirm the protection is working (see Recommended actions for operators).
Deterministic Reproduction
We needed to reproduce the race before we could claim a fix, so we built a harness that triggers it on demand on a 1P1D pair. An env-gated delay inside prefill’s send_kvcache holds a launched write in flight, --max-total-tokens 96 forces immediate slot reuse, and instrumentation logs every request’s slot range and every free-or-hold decision.
With the window held open, the overlap appears every time: Decode frees request A’s slots [14..44] while its write is in flight, request B allocates [1..32] , and the two ranges collide on [14..32] . A software delay cannot make the write itself land late on a single P/D pair, because the transfer queue serializes writes to the same decode engine. To show wrong output , not only overlapping slot numbers, we copied the aborted request’s freed page over the overlap at the victim’s commit point, which is what a late write does. Without the fix, the victim’s output was garbage. With the fix, decode held the donor’s slots, the victim got fresh slots, and the output was identical to the baseline.
The real late landing also reproduces end to end on live hardware once two prefill engines share one decode, so nothing serializes their writes. We ran it on a 2×H200 pair (Mooncake over RDMA) with the hold disabled. A one-sided abort freed the donor’s 430 slots, the victim preallocated [1..105] inside them, and the donor’s launched write landed mid-decode. The victim counted correctly up to 80, then its output turned into the donor’s prompt text: Another request’s KVCache, read back out of its generation. With the hold enabled and the same timing, decode logged hold, drain-ack, and release, and the victim waited for the release and then produced output identical to the baseline, byte for byte. The full recipe (harness patch, launch script, driver, and the observed outputs) is in a public gist .
The Fix: Deferred KVCache Release
Decode cannot cancel prefill’s launched writes, so it keeps the aborted request’s slots reserved for longer than those writes can keep landing:
T_hold > t_abort_propagation + t_remaining_chunks + t_in_flight_call
The fix is safe only if this inequality holds on every abort path. The rest of the design makes every abort path hold the slots (the left side) and bounds each term on the right (detailed in #44186 ). Waiting for completion also fits the hardware: Reliable-connection RDMA executes work requests in order, so “all writes drained” is a single completion-queue observation on the sender.
Deferred Release
We built the mechanism in three steps:
Notify prefill on abort ( #27372 ). On a decode-side abort, decode sends ABORT to every prefill rank, and each rank drops every chunk still waiting in the software queue for that room. That cuts t_remaining_chunks to near zero. Without the notification, every remaining chunk of the transfer launches and lands, so the term covers the entire rest of the prefill. t_in_flight_call
首次收录 · 2026-10-27 · 7.95 分