sorry, too many clients already #15127

Closed
opened 2026-02-21 19:20:18 -05:00 by yindo · 11 comments
Owner

Originally created by @froukee on GitHub (Jul 4, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.5.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Those there are only 20 concurrent dify requests, a database connection error will occur.It will directly cause the request to fail instead of waiting in the queue, which is unreasonable. How do I fix this BUG?

✔️ Expected Behavior

No response

Actual Behavior

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

Traceback (most recent call last):
  File "/app/api/core/workflow/nodes/llm/node.py", line 192, in _run
    model_instance, model_config = self._fetch_model_config(self.node_data.model)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/workflow/nodes/llm/node.py", line 543, in _fetch_model_config
    model, model_config_with_cred = llm_utils.fetch_model_config(
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/workflow/nodes/llm/llm_utils.py", line 36, in fetch_model_config
    model = ModelManager().get_model_instance(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/model_manager.py", line 430, in get_model_instance
    provider_model_bundle = self._provider_manager.get_provider_model_bundle(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/provider_manager.py", line 253, in get_provider_model_bundle
    provider_configurations = self.get_configurations(tenant_id)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/provider_manager.py", line 98, in get_configurations
    provider_name_to_provider_records_dict = self._get_all_providers(tenant_id)
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/provider_manager.py", line 401, in _get_all_providers
    providers = session.scalars(stmt)
                ^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2473, in scalars
    return self._execute_internal(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2241, in _execute_internal
    conn = self._connection_for_bind(bind)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2110, in _connection_for_bind
    return trans._connection_for_bind(engine, execution_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 2, in _connection_for_bind
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
                ^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1189, in _connection_for_bind
    conn = bind.connect()
           ^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3273, in connect
    return self._connection_cls(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 147, in __init__
    Connection._handle_dbapi_exception_noconnection(
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2436, in _handle_dbapi_exception_noconnection
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
    self._dbapi_connection = engine.raw_connection()
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3297, in raw_connection
    return self.pool.connect()
           ^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 449, in connect
    return _ConnectionFairy._checkout(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 1264, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 713, in checkout
    rec = pool._do_get()
          ^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 179, in _do_get
    with util.safe_reraise():
         ^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 224, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 177, in _do_get
    return self._create_connection()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
    return _ConnectionRecord(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 675, in __init__
    self.__connect()
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 901, in __connect
    with util.safe_reraise():
         ^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 224, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 897, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/create.py", line 646, in connect
    return dialect.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 625, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)  # type: ignore[no-any-return]  # NOQA: E501
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/psycogreen/gevent.py", line 32, in gevent_wait_callback
    state = conn.poll()
            ^^^^^^^^^^^
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL:  sorry, too many clients already
Originally created by @froukee on GitHub (Jul 4, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.5.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Those there are only 20 concurrent dify requests, a database connection error will occur.It will directly cause the request to fail instead of waiting in the queue, which is unreasonable. How do I fix this BUG? ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior The above exception was the direct cause of the following exception: ``` Traceback (most recent call last): File "/app/api/core/workflow/nodes/llm/node.py", line 192, in _run model_instance, model_config = self._fetch_model_config(self.node_data.model) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/workflow/nodes/llm/node.py", line 543, in _fetch_model_config model, model_config_with_cred = llm_utils.fetch_model_config( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/workflow/nodes/llm/llm_utils.py", line 36, in fetch_model_config model = ModelManager().get_model_instance( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_manager.py", line 430, in get_model_instance provider_model_bundle = self._provider_manager.get_provider_model_bundle( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/provider_manager.py", line 253, in get_provider_model_bundle provider_configurations = self.get_configurations(tenant_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/provider_manager.py", line 98, in get_configurations provider_name_to_provider_records_dict = self._get_all_providers(tenant_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/provider_manager.py", line 401, in _get_all_providers providers = session.scalars(stmt) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2473, in scalars return self._execute_internal( ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2241, in _execute_internal conn = self._connection_for_bind(bind) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2110, in _connection_for_bind return trans._connection_for_bind(engine, execution_options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<string>", line 2, in _connection_for_bind File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go ret_value = fn(self, *arg, **kw) ^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1189, in _connection_for_bind conn = bind.connect() ^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3273, in connect return self._connection_cls(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 147, in __init__ Connection._handle_dbapi_exception_noconnection( File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2436, in _handle_dbapi_exception_noconnection raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 145, in __init__ self._dbapi_connection = engine.raw_connection() ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3297, in raw_connection return self.pool.connect() ^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 449, in connect return _ConnectionFairy._checkout(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 1264, in _checkout fairy = _ConnectionRecord.checkout(pool) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 713, in checkout rec = pool._do_get() ^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 179, in _do_get with util.safe_reraise(): ^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 224, in __exit__ raise exc_value.with_traceback(exc_tb) File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 177, in _do_get return self._create_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection return _ConnectionRecord(self) ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 675, in __init__ self.__connect() File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 901, in __connect with util.safe_reraise(): ^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 224, in __exit__ raise exc_value.with_traceback(exc_tb) File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 897, in __connect self.dbapi_connection = connection = pool._invoke_creator(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/create.py", line 646, in connect return dialect.connect(*cargs, **cparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 625, in connect return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/psycopg2/__init__.py", line 122, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/psycogreen/gevent.py", line 32, in gevent_wait_callback state = conn.poll() ^^^^^^^^^^^ sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: sorry, too many clients already ```
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 19:20:18 -05:00
yindo closed this issue 2026-02-21 19:20:18 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 4, 2025):

This error means your PostgreSQL server has hit its max_connections limit, so new requests can't get a database connection and fail immediately instead of waiting. In Dify (self-hosted/Docker), this usually happens when the SQLAlchemy connection pool or the database itself is not tuned for your concurrency needs.

You can fix this by:

  1. Increase PostgreSQL's max_connections in your database config (often in postgresql.conf or via the POSTGRES_MAX_CONNECTIONS environment variable if using Docker). Make sure this value is high enough to handle your expected concurrency plus some buffer.

  2. Tune Dify's SQLAlchemy pool settings by setting these environment variables in your .env or docker-compose.yaml:

    • SQLALCHEMY_POOL_SIZE (default is 30)
    • SQLALCHEMY_MAX_OVERFLOW
    • POOL_RECYCLE
    • APP_MAX_ACTIVE_REQUESTS
    • SERVER_WORKER_AMOUNT
    • SERVER_WORKER_CONNECTIONS

    Example for .env:

    SQLALCHEMY_POOL_SIZE=30
    SQLALCHEMY_MAX_OVERFLOW=10
    POOL_RECYCLE=1800
    POSTGRES_MAX_CONNECTIONS=100
    
  3. Restart your Docker containers after making changes:

    docker-compose down
    docker-compose up -d
    

    Reference

  4. Best practices: In multi-threaded environments, make sure each thread uses its own SQLAlchemy session (use scoped_session or create a new session per thread) to avoid session conflicts and connection leaks Reference.

Recent code changes have improved connection handling by ensuring sessions are closed before starting new threads, which helps release connections more promptly and reduces exhaustion risk (see PR).

If you still hit the limit, check for connection leaks or long-lived sessions in your code or custom plugins. If you need more detailed help, please share your current max_connections and pool settings.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jul 4, 2025): <!-- Answer --> This error means your PostgreSQL server has hit its max_connections limit, so new requests can't get a database connection and fail immediately instead of waiting. In Dify (self-hosted/Docker), this usually happens when the SQLAlchemy connection pool or the database itself is not tuned for your concurrency needs. You can fix this by: 1. **Increase PostgreSQL's max_connections** in your database config (often in `postgresql.conf` or via the `POSTGRES_MAX_CONNECTIONS` environment variable if using Docker). Make sure this value is high enough to handle your expected concurrency plus some buffer. 2. **Tune Dify's SQLAlchemy pool settings** by setting these environment variables in your `.env` or `docker-compose.yaml`: - `SQLALCHEMY_POOL_SIZE` (default is 30) - `SQLALCHEMY_MAX_OVERFLOW` - `POOL_RECYCLE` - `APP_MAX_ACTIVE_REQUESTS` - `SERVER_WORKER_AMOUNT` - `SERVER_WORKER_CONNECTIONS` Example for `.env`: ``` SQLALCHEMY_POOL_SIZE=30 SQLALCHEMY_MAX_OVERFLOW=10 POOL_RECYCLE=1800 POSTGRES_MAX_CONNECTIONS=100 ``` 3. **Restart your Docker containers** after making changes: ``` docker-compose down docker-compose up -d ``` [Reference](https://github.com/langgenius/dify/issues/21535) 4. **Best practices:** In multi-threaded environments, make sure each thread uses its own SQLAlchemy session (use `scoped_session` or create a new session per thread) to avoid session conflicts and connection leaks [Reference](https://github.com/langgenius/dify/issues/21294). Recent code changes have improved connection handling by ensuring sessions are closed before starting new threads, which helps release connections more promptly and reduces exhaustion risk ([see PR](https://github.com/langgenius/dify/pull/21726)). If you still hit the limit, check for connection leaks or long-lived sessions in your code or custom plugins. If you need more detailed help, please share your current `max_connections` and pool settings. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/39dde8fb-6b10-4061-8a29-3966cb1bb5bd?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/39dde8fb-6b10-4061-8a29-3966cb1bb5bd?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/39dde8fb-6b10-4061-8a29-3966cb1bb5bd?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/39dde8fb-6b10-4061-8a29-3966cb1bb5bd?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/39dde8fb-6b10-4061-8a29-3966cb1bb5bd?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/39dde8fb-6b10-4061-8a29-3966cb1bb5bd?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/39dde8fb-6b10-4061-8a29-3966cb1bb5bd?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/21931)
Author
Owner

@tracy19880727 commented on GitHub (Aug 5, 2025):

Hello, I also had this issue in the 1.7.1 version of my docker deployment, my parameter configuration is as follows:

Image Image The database initially has only 10 connections, as shown in the figure below: Image Perform a stress test of 100QPS on dify, and the number of connections increases to 900, as follows: Image Most of the connections come from the API, as follows: Image The process of stress testing is simple and follows: Image I'm not a python developer and don't know how to modify the best practices mentioned above , Please help, thanks !@crazywoola @froukee @dosu
@tracy19880727 commented on GitHub (Aug 5, 2025): Hello, I also had this issue in the 1.7.1 version of my docker deployment, my parameter configuration is as follows: <img width="423" height="81" alt="Image" src="https://github.com/user-attachments/assets/ae740408-e87d-40f8-9e2a-33095c4a77b5" /> <img width="865" height="190" alt="Image" src="https://github.com/user-attachments/assets/a4b3eb27-dbc1-4294-81d5-fd75c4735d07" /> The database initially has only 10 connections, as shown in the figure below: <img width="961" height="596" alt="Image" src="https://github.com/user-attachments/assets/2a22a4bd-4cad-4134-9492-60a80348c708" /> Perform a stress test of 100QPS on dify, and the number of connections increases to 900, as follows: <img width="1109" height="541" alt="Image" src="https://github.com/user-attachments/assets/29ead1a7-5c2b-456a-b0e1-a039c93b7cb2" /> Most of the connections come from the API, as follows: <img width="756" height="83" alt="Image" src="https://github.com/user-attachments/assets/6b900351-ef5a-4bb7-87ef-b93495776274" /> The process of stress testing is simple and follows: <img width="1532" height="521" alt="Image" src="https://github.com/user-attachments/assets/d58ddb69-4108-41bb-b685-594e2fb39fe5" /> I'm not a python developer and don't know how to modify the best practices mentioned above , Please help, thanks !@crazywoola @froukee @dosu
Author
Owner

@LeoLiuYan commented on GitHub (Aug 12, 2025):

We have encountered the same problem. Could you please advise on how to handle it?
Dify version: 1.7.1
@crazywoola

@LeoLiuYan commented on GitHub (Aug 12, 2025): We have encountered the same problem. Could you please advise on how to handle it? Dify version: 1.7.1 @crazywoola
Author
Owner

@Jimmy-L99 commented on GitHub (Aug 13, 2025):

Meet the same problem, have you solved the problem yet? These environment variables I have set to a large num, but still meet error.
SQLALCHEMY_POOL_SIZE
SQLALCHEMY_MAX_OVERFLOW
POSTGRES_MAX_CONNECTIONS

@Jimmy-L99 commented on GitHub (Aug 13, 2025): Meet the same problem, have you solved the problem yet? These environment variables I have set to a large num, but still meet error. SQLALCHEMY_POOL_SIZE SQLALCHEMY_MAX_OVERFLOW POSTGRES_MAX_CONNECTIONS
Author
Owner

@oDoubleyz commented on GitHub (Sep 10, 2025):

我们也遇到了同样的问题。请问您能指点一下如何处理吗? Dify 版本:1.7.1 @crazywoola

same problem

@oDoubleyz commented on GitHub (Sep 10, 2025): > 我们也遇到了同样的问题。请问您能指点一下如何处理吗? Dify 版本:1.7.1 [@crazywoola](https://github.com/crazywoola) same problem
Author
Owner

@Lyeluo commented on GitHub (Oct 27, 2025):

same problem, and i changed .env file param POSTGRES_MAX_CONNECTIONS is not useful

@Lyeluo commented on GitHub (Oct 27, 2025): same problem, and i changed .env file param POSTGRES_MAX_CONNECTIONS is not useful
Author
Owner

@lywy233 commented on GitHub (Nov 12, 2025):

Same problem, I set the maximum number of connections in pg to 200, and sqlalchemy to 30, but there is still this error, I found that the current number of connections after restarting the API service is less than 30, that is, the API service occupies 170 connections before restarting, which seems to be inconsistent with the configuration

@lywy233 commented on GitHub (Nov 12, 2025): Same problem, I set the maximum number of connections in pg to 200, and sqlalchemy to 30, but there is still this error, I found that the current number of connections after restarting the API service is less than 30, that is, the API service occupies 170 connections before restarting, which seems to be inconsistent with the configuration
Author
Owner

@dragon0311 commented on GitHub (Nov 17, 2025):

same problem, and i changed .env file param POSTGRES_MAX_CONNECTIONS to a Large number: 5000, but still not useful

@dragon0311 commented on GitHub (Nov 17, 2025): same problem, and i changed .env file param POSTGRES_MAX_CONNECTIONS to a Large number: 5000, but still not useful
Author
Owner

@Modas-Li commented on GitHub (Nov 20, 2025):

same issue

@Modas-Li commented on GitHub (Nov 20, 2025): same issue
Author
Owner

@nvictorm commented on GitHub (Dec 17, 2025):

same issue dify-api:1.10.0

@nvictorm commented on GitHub (Dec 17, 2025): same issue dify-api:1.10.0
Author
Owner

@Victor94-king commented on GitHub (Jan 3, 2026):

Hi, I met the same issue and have you closed it ?

@Victor94-king commented on GitHub (Jan 3, 2026): Hi, I met the same issue and have you closed it ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15127