From a80d6f150c39e9e7121a54d293aa1d09619118c2 Mon Sep 17 00:00:00 2001 From: Avshalom Manevich Date: Wed, 29 Apr 2026 18:48:47 +0200 Subject: [PATCH] better logging for large uncachable items (#41145) Signed-off-by: h-avsha --- vllm/multimodal/cache.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/vllm/multimodal/cache.py b/vllm/multimodal/cache.py index c0df19d4f4..833b405ff6 100644 --- a/vllm/multimodal/cache.py +++ b/vllm/multimodal/cache.py @@ -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