From 50a7311dd51650bc3a98b5560d21a40323fc4843 Mon Sep 17 00:00:00 2001 From: Rintaro Date: Fri, 5 Jun 2026 10:15:48 +0900 Subject: [PATCH] fix(opensearch): set pool_maxsize so the shared client keeps a real connection pool --- rag/utils/opensearch_conn.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rag/utils/opensearch_conn.py b/rag/utils/opensearch_conn.py index e68a033d8c5..15c6e334e30 100644 --- a/rag/utils/opensearch_conn.py +++ b/rag/utils/opensearch_conn.py @@ -73,7 +73,16 @@ def __init__(self): http_auth=(settings.OS["username"], settings.OS[ "password"]) if "username" in settings.OS and "password" in settings.OS else None, verify_certs=False, - timeout=600 + timeout=600, + # opensearch-py leaves pool_maxsize unset, so the underlying + # urllib3 HTTPConnectionPool falls back to maxsize=1. + # OSConnection is a @singleton shared by every request thread, + # so concurrent searches and the cluster.health() probe contend + # on a single HTTP connection ("Connection pool is full, + # discarding connection ... pool size: 1"), serializing requests + # behind fresh TLS handshakes. Widen the pool to match the + # multi-connection default elasticsearch-py already uses. + pool_maxsize=10, ) if self.os: self.info = self.os.info()