[BUGFIX] fix radix cache memory consumption to avoid OOM (#17191)

Co-authored-by: Liangsheng Yin <lsyincs@gmail.com>
This commit is contained in:
Yi Zhang
2026-01-17 16:47:37 +08:00
committed by GitHub
parent dc743fe4ba
commit 737a1183d6
5 changed files with 45 additions and 11 deletions

View File

@@ -654,10 +654,10 @@ class RadixCache(BasePrefixCache):
new_node.parent = child.parent
new_node.lock_ref = child.lock_ref
new_node.key = child.key[:split_len]
new_node.value = child.value[:split_len]
new_node.value = child.value[:split_len].clone()
child.parent = new_node
child.key = child.key[split_len:]
child.value = child.value[split_len:]
child.value = child.value[split_len:].clone()
new_node.parent.children[self.get_child_key_fn(key)] = new_node
# Split hash_value if it was already computed, otherwise leave as None
@@ -703,7 +703,7 @@ class RadixCache(BasePrefixCache):
new_node = TreeNode(priority=priority)
new_node.parent = node
new_node.key = key
new_node.value = value
new_node.value = value.clone()
node.children[child_key] = new_node
self.evictable_size_ += len(key)
# Hash will be computed lazily during event emission