better logging for large uncachable items (#41145)

Signed-off-by: h-avsha <avshalom.manevich@hcompany.ai>
This commit is contained in:
Avshalom Manevich
2026-04-29 09:48:47 -07:00
committed by GitHub
parent 91a2d39014
commit a80d6f150c
+21 -5
View File
@@ -511,11 +511,27 @@ class ShmObjectStoreSenderCache(BaseMultiModalProcessorCache):
self._p0_cache[mm_hash] = prompt_updates
return self.address_as_item(address, monotonic_id), prompt_updates
except (ValueError, MemoryError) as e:
# put may fail if the object is too large or
# the cache is full.
# In this case we log the error and keep the original mm_input.
logger.debug("Failed to cache mm_input with hash %s: %s", mm_hash, e)
except ValueError as e:
# `put` raises ValueError either for an oversize item or for a
# duplicate key (concurrent insert); the latter is benign so we
# only warn on the oversize case. Subsequent UUID-only requests
# for an oversize item will fail with a cache miss.
if "already exists" not in str(e):
logger.warning_once(
"mm_input %s too large to cache; "
"raise --mm-shm-cache-max-object-size-mb. (%s)",
mm_hash,
str(e),
)
return mm_item
except MemoryError as e:
# Cache full and protected items prevent eviction.
logger.debug(
"mm_input %s not cached; shm cache full, "
"consider raising --mm-processor-cache-gb. (%s)",
mm_hash,
str(e),
)
return mm_item
@override