Skip to content

1x1 input image can crash /v1/embeddings endpoint until pod restart while health check endpoint continues to return 200 #609

@scottt732

Description

@scottt732

System Info

We have an image processing pipeline where we're using Infinity behind KubeAI to compute CLIP embeddings for images.

curl -vv http://kubeai/openai/v1/embeddings \
  --http1.1 -H "Authorization: Bearer blah" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "https://some.image.url/image.png",
    "model": "infinity-hosted-clip-embedding-model",
    "modality": "image"
  }'

Every now and then we get into a situation where a single bad request comes along (working on trying to isolate it). From that point on, our steady stream of embeddings, health, and metrics calls ... becomes a steady stream of just health check and metric calls (both of which continue to return 200s). The model stays running but stops receiving any embedding requests from kubeai and we essentially lose 1/n of our throughput.

INFO:     10.15.5.245:57645 - "POST /v1/embeddings HTTP/1.1" 200 OK
ERROR    2025-06-26 13:23:51,860 infinity_emb ERROR: broken batch_handler.py:557
         data stream when reading image file
         Traceback (most recent call last):
           File
         "/app/infinity_emb/inference/batch_handler.py",
         line 541, in _preprocess_batch
             feat = self._model.encode_pre(items_for_pre)
           File
         "/app/infinity_emb/transformer/vision/torch_vision
         .py", line 159, in encode_pre
             preprocessed = self.processor(
           File
         "/app/.venv/lib/python3.10/site-packages/transform
         ers/models/clip/processing_clip.py", line 109, in
         __call__
             image_features = self.image_processor(images,
         return_tensors=return_tensors,
         **image_processor_kwargs)
           File
         "/app/.venv/lib/python3.10/site-packages/transform
         ers/image_processing_utils.py", line 41, in
         __call__
             return self.preprocess(images, **kwargs)
           File
         "/app/.venv/lib/python3.10/site-packages/transform
         ers/models/clip/image_processing_clip.py", line
         307, in preprocess
             images = [convert_to_rgb(image) for image in
         images]
           File
         "/app/.venv/lib/python3.10/site-packages/transform
         ers/models/clip/image_processing_clip.py", line
         307, in <listcomp>
             images = [convert_to_rgb(image) for image in
         images]
           File
         "/app/.venv/lib/python3.10/site-packages/transform
         ers/image_transforms.py", line 776, in
         convert_to_rgb
             image = image.convert("RGB")
           File
         "/app/.venv/lib/python3.10/site-packages/PIL/Image
         .py", line 995, in convert
             self.load()
           File
         "/app/.venv/lib/python3.10/site-packages/PIL/Image
         File.py", line 312, in load
             raise _get_oserror(err_code, encoder=False)
         OSError: broken data stream when reading image
         file

Any ideas?

Information

  • Docker + cli
  • pip + cli
  • pip + usage of Python interface

Tasks

  • An officially supported CLI command
  • My own modifications

Reproduction

I'm trying to find the image URL that reproduces this. Will update back if I find one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions