Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supabase as Vector DB FATAL: Max client connections reached #43

Closed
meera opened this issue Apr 9, 2024 · 4 comments · Fixed by #95
Closed

Supabase as Vector DB FATAL: Max client connections reached #43

meera opened this issue Apr 9, 2024 · 4 comments · Fixed by #95

Comments

@meera
Copy link

meera commented Apr 9, 2024

Project generated with create-llama.
Works most of the time - after a while throws up this error.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/applications.py", line 123, in call
await self.middleware_stack(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/middleware/cors.py", line 83, in call
await self.app(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 758, in call
await self.middleware_stack(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 778, in app
await route.handle(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle
await self.app(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 79, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app
raise e
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/aSearch/backend-asearch/app/api/routers/chat.py", line 157, in chat_request
response = await chat_engine.achat(last_message_content, messages)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/callbacks/utils.py", line 56, in async_wrapper
return await func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/chat_engine/condense_plus_context.py", line 326, in achat
chat_messages, context_source, context_nodes = await self._arun_c3(
^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/chat_engine/condense_plus_context.py", line 249, in _arun_c3
context_str, context_nodes = await self._aretrieve_context(condensed_question)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/chat_engine/condense_plus_context.py", line 181, in _aretrieve_context
nodes = await self._retriever.aretrieve(message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/base/base_retriever.py", line 249, in aretrieve
nodes = await self._aretrieve(query_bundle)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py", line 105, in _aretrieve
return await self._aget_nodes_with_embeddings(query_bundle)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py", line 177, in _aget_nodes_with_embeddings
query_result = await self._vector_store.aquery(query, **self._kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/vector_stores/postgres/base.py", line 638, in aquery
self._initialize()
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/vector_stores/postgres/base.py", line 295, in _initialize
self._create_extension()
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/vector_stores/postgres/base.py", line 288, in _create_extension
session.execute(statement)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2306, in execute
return self._execute_internal(
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2181, in _execute_internal
conn = self._connection_for_bind(bind)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2050, in _connection_for_bind
return trans._connection_for_bind(engine, execution_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 2, in _connection_for_bind
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
ret_value = fn(self, *arg, **kw)
^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1144, in _connection_for_bind
conn = bind.connect()
^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3280, in connect
return self._connection_cls(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 148, in init
Connection._handle_dbapi_exception_noconnection(
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2444, in _handle_dbapi_exception_noconnection
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 146, in init
self._dbapi_connection = engine.raw_connection()
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3304, in raw_connection
return self.pool.connect()
^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 449, in connect
return _ConnectionFairy._checkout(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 1263, in _checkout
fairy = _ConnectionRecord.checkout(pool)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
rec = pool._do_get()
^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 179, in _do_get
with util.safe_reraise():
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in exit
raise exc_value.with_traceback(exc_tb)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 177, in _do_get
return self._create_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
return _ConnectionRecord(self)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 674, in init
self.__connect()
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
with util.safe_reraise():
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in exit
raise exc_value.with_traceback(exc_tb)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
self.dbapi_connection = connection = pool._invoke_creator(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/create.py", line 643, in connect
return dialect.connect(*cargs, **cparams)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 617, in connect
return self.loaded_dbapi.connect(*cargs, **cparams)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/psycopg2/init.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/applications.py", line 123, in call
await self.middleware_stack(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/middleware/cors.py", line 83, in call
await self.app(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 758, in call
await self.middleware_stack(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 778, in app
await route.handle(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle
await self.app(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 79, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app
raise e
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/aSearch/backend-asearch/app/api/routers/chat.py", line 157, in chat_request
response = await chat_engine.achat(last_message_content, messages)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/callbacks/utils.py", line 56, in async_wrapper
return await func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/chat_engine/condense_plus_context.py", line 326, in achat
chat_messages, context_source, context_nodes = await self._arun_c3(
^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/chat_engine/condense_plus_context.py", line 249, in _arun_c3
context_str, context_nodes = await self._aretrieve_context(condensed_question)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/chat_engine/condense_plus_context.py", line 181, in _aretrieve_context
nodes = await self._retriever.aretrieve(message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/base/base_retriever.py", line 249, in aretrieve
nodes = await self._aretrieve(query_bundle)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py", line 105, in _aretrieve
return await self._aget_nodes_with_embeddings(query_bundle)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py", line 177, in _aget_nodes_with_embeddings
query_result = await self._vector_store.aquery(query, **self._kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/vector_stores/postgres/base.py", line 638, in aquery
self._initialize()
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/vector_stores/postgres/base.py", line 295, in _initialize
self._create_extension()
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/llama_index/vector_stores/postgres/base.py", line 288, in _create_extension
session.execute(statement)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2306, in execute
return self._execute_internal(
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2181, in _execute_internal
conn = self._connection_for_bind(bind)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2050, in _connection_for_bind
return trans._connection_for_bind(engine, execution_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 2, in _connection_for_bind
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
ret_value = fn(self, *arg, **kw)
^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1144, in _connection_for_bind
conn = bind.connect()
^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3280, in connect
return self._connection_cls(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 148, in init
Connection._handle_dbapi_exception_noconnection(
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2444, in _handle_dbapi_exception_noconnection
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 146, in init
self._dbapi_connection = engine.raw_connection()
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3304, in raw_connection
return self.pool.connect()
^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 449, in connect
return _ConnectionFairy._checkout(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 1263, in _checkout
fairy = _ConnectionRecord.checkout(pool)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
rec = pool._do_get()
^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 179, in _do_get
with util.safe_reraise():
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in exit
raise exc_value.with_traceback(exc_tb)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 177, in _do_get
return self._create_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
return _ConnectionRecord(self)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 674, in init
self.__connect()
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
with util.safe_reraise():
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in exit
raise exc_value.with_traceback(exc_tb)
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
self.dbapi_connection = connection = pool._invoke_creator(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/create.py", line 643, in connect
return dialect.connect(*cargs, **cparams)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 617, in connect
return self.loaded_dbapi.connect(*cargs, **cparams)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Me/Library/Caches/pypoetry/virtualenvs/app-BCQ_KSqF-py3.11/lib/python3.11/site-packages/psycopg2/init.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "aws-0-us-westxx.pooler.supabase.com" (), port 5432 failed: FATAL: Max client connections reached

@marcusschiesser
Copy link
Collaborator

Your error:

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "[aws-0-us-westxx.pooler.supabase.com](http://aws-0-us-westxx.pooler.supabase.com/)" (), port 5432 failed: FATAL: Max client connections reached

Seems like you run into a limit of Supabase. Might be related to your Supabase plan?

@meera
Copy link
Author

meera commented Apr 9, 2024

Your error:

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "[aws-0-us-westxx.pooler.supabase.com](http://aws-0-us-westxx.pooler.supabase.com/)" (), port 5432 failed: FATAL: Max client connections reached

Seems like you run into a limit of Supabase. Might be related to your Supabase plan?

Unlikely, running on local with manually run tests - hitting /api/chat/request FastAPI end point.

@marcusschiesser
Copy link
Collaborator

@meera my guess is that each /api/chat/request request uses one connection we'll have to take a closer look into this

@marcusschiesser
Copy link
Collaborator

@meera this is fixed in create-llama@0.1.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants