Skip to content

[Bug]: collection.add() hangs indefinitely on Windows with Rust bindings (v1.3.5) #5937

@JiangZhihao123

Description

@JiangZhihao123

What happened?

What happened?

On Windows, calling collection.add() with ChromaDB 1.3.5 hangs indefinitely and never returns. The issue is in the Rust bindings (chromadb_rust_bindings.pyd).

Versions

  • ChromaDB: 1.3.5
  • OS: Windows 10/11
  • Python: 3.10 / 3.11

Minimal reproduction

import chromadb
from chromadb.config import Settings

client = chromadb.Client(Settings(anonymized_telemetry=False))
collection = client.create_collection('test', embedding_function=None)

# This hangs indefinitely:
collection.add(ids=['id1'], embeddings=[[0.1, 0.2, 0.3]])

Root cause analysis

Using Python's sys.settrace() for line-by-line tracing, the hang occurs at:

  • File: chromadb/api/rust.py, line 441
  • Code: return self.bindings.add(...)
  • The call into chromadb_rust_bindings.Bindings.add() never returns

Trace output:

TRACE: chromadb\api\rust.py:441 in _add
TRACE: chromadb\api\rust.py:442 in _add
... (hangs here, loops indefinitely)

Workaround

Using SegmentAPI instead of the default Rust bindings works correctly:

from chromadb.config import Settings

settings = Settings(
    anonymized_telemetry=False,
    chroma_api_impl="chromadb.api.segment.SegmentAPI",  # Use Python implementation
)
client = chromadb.Client(settings)
collection = client.create_collection('test', embedding_function=None)
collection.add(ids=['id1'], embeddings=[[0.1, 0.2, 0.3]])  # Works!

Suggested fix

Option 1: Investigate the Rust bindings blocking issue on Windows (may be threading/async related)

Option 2: Default to SegmentAPI on Windows platform until the Rust issue is resolved

import platform

if platform.system() == "Windows":
    default_api_impl = "chromadb.api.segment.SegmentAPI"

Versions

ChromaDB: 1.3.5
OS: Windows 10/11
Python: 3.10 / 3.11

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions