You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: HTTP clients leave an unreleasable entry in SharedSystemClient._identifier_to_system after close() (orphan from _populate_data_from_system) #7915
For HTTP-backed clients the system identifier is a fresh uuid4() on every call to SharedSystemClient._get_identifier_from_settings. Client.__init__ creates the internal admin client with AdminClient.from_system(self._system), which calls _populate_data_from_system(system). That method computes the identifier again (a new uuid) and stores the same System under it, without touching _identifier_to_refcount.
Client.close() only releases self._identifier and self._admin_client._identifier, so the extra entry stays in the class-level _identifier_to_system forever, holding a reference to the stopped System. Every HttpClient created and closed in a long-running process leaves one entry behind.
PersistentClient is not affected, because its identifier is the persist path, so the extra registration overwrites the same key.
AsyncClient.create has the same pattern twice (_populate_data_from_system(self._system) plus AsyncAdminClient.from_system(...)), so it leaves two such entries. This is in addition to #7694, where AsyncClient has no close() at all.
Minimal repro (chromadb 1.5.9, Python 3.11)
importchromadbfromchromadb.configimportSettingsfromchromadb.api.shared_system_clientimportSharedSystemClientasS# a chroma server running on 127.0.0.1:8000before=set(S._identifier_to_system)
c=chromadb.HttpClient(host="127.0.0.1", port=8000, settings=Settings(anonymized_telemetry=False))
print(len(set(S._identifier_to_system) -before)) # 3c.close()
print(len(set(S._identifier_to_system) -before)) # 1 <- expected 0
For comparison, PersistentClient(path=...) prints 1 and then 0.
Expected
After close(), no entry created by the client stays in _identifier_to_system. For example, _populate_data_from_system could reuse the system's existing identifier instead of generating a new one, or the admin client could be built from the existing identifier.
Versions
chromadb 1.5.9 (latest on PyPI), Python 3.11, macOS.
Activity