From 520ca548eac9c9f841e1c1a3a73c03a825cc8271 Mon Sep 17 00:00:00 2001 From: alphabetc1 <2508695655@qq.com> Date: Fri, 6 Nov 2026 10:14:25 +0800 Subject: [PATCH] [Fix] hicache: Wait for overlapping write-through acknowledgements (cherry picked from commit 032725770c33c61c236f2884ce7e7ff1fa99cef9) --- python/sglang/srt/mem_cache/unified_radix_cache.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python/sglang/srt/mem_cache/unified_radix_cache.py b/python/sglang/srt/mem_cache/unified_radix_cache.py index 4dd52bc3d4..f0da45c627 100644 --- a/python/sglang/srt/mem_cache/unified_radix_cache.py +++ b/python/sglang/srt/mem_cache/unified_radix_cache.py @@ -1694,6 +1694,16 @@ class UnifiedRadixCache(BasePrefixCache): # backed up. Skip only when no transfer remains. if device_value.numel() == 0 and not comp_xfers: continue + # A split fragment keeps the original node's ack, and component + # transfers can cover other nodes. Check the whole publish set, + # not just ack keys, before assigning any node a new ack owner. + publish_set = set(self._backup_publish_node_ids(node_id, comp_xfers)) + # Write-back eviction has its own round-wide completion barrier. + if not write_back and any( + not publish_set.isdisjoint(pending.publish_node_ids) + for pending in self.ongoing_write_through.values() + ): + self.writing_check(write_back=True) sidecar_xfers = self._build_backup_sidecar(device_value, comp_xfers) host_indices = self._execute_kv_backup( node_id, device_value, comp_xfers, sidecar_xfers