Failed after 3 retries. Last error: Connection pool shut down #14069

Closed
opened 2026-02-21 19:15:24 -05:00 by yindo · 2 comments
Owner

Originally created by @devops-jiangxl on GitHub (May 21, 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.4.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I would like to consult if there is any configuration on Dify regarding the application setting the number of connection pools. Now, when my own service calls the application arranged on Dify, it is found that there is an error "connection pool shutdown" reported

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @devops-jiangxl on GitHub (May 21, 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.4.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I would like to consult if there is any configuration on Dify regarding the application setting the number of connection pools. Now, when my own service calls the application arranged on Dify, it is found that there is an error "connection pool shutdown" reported ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 19:15:24 -05:00
yindo closed this issue 2026-02-21 19:15:24 -05:00
Author
Owner

@crazywoola commented on GitHub (May 21, 2025):

This is only for bug report, if you would like to ask a question, please head to Discussions.

@crazywoola commented on GitHub (May 21, 2025): 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).
Author
Owner

@dosubot[bot] commented on GitHub (May 21, 2025):

The "connection pool shutdown" error you're encountering in Dify version 1.4.0 could be related to the configuration of your connection pools. Here are some configuration options you can adjust:

  1. SQLALCHEMY_POOL_SIZE: This sets the maximum number of database connections in the pool. The default is 30, but you might need to adjust this based on your workload.

  2. SQLALCHEMY_MAX_OVERFLOW: This specifies the maximum number of connections that can be created beyond the pool size. The default is 10.

  3. SQLALCHEMY_POOL_RECYCLE: This sets the database connection pool recycling time, with a default of 3600 seconds.

For a self-hosted Docker environment, you can modify these settings by changing the respective environment variables in your configuration file. It's recommended to set SQLALCHEMY_POOL_SIZE to 20 when using a managed PostgreSQL database service to prevent connection slot exhaustion while maintaining performance [1][2].

If the issue persists, you might want to check your logs for any specific error messages that could provide more insight into the cause of the shutdown.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (May 21, 2025): <!-- Answer --> The "connection pool shutdown" error you're encountering in Dify version 1.4.0 could be related to the configuration of your connection pools. Here are some configuration options you can adjust: 1. **SQLALCHEMY_POOL_SIZE**: This sets the maximum number of database connections in the pool. The default is 30, but you might need to adjust this based on your workload. 2. **SQLALCHEMY_MAX_OVERFLOW**: This specifies the maximum number of connections that can be created beyond the pool size. The default is 10. 3. **SQLALCHEMY_POOL_RECYCLE**: This sets the database connection pool recycling time, with a default of 3600 seconds. For a self-hosted Docker environment, you can modify these settings by changing the respective environment variables in your configuration file. It's recommended to set `SQLALCHEMY_POOL_SIZE` to 20 when using a managed PostgreSQL database service to prevent connection slot exhaustion while maintaining performance <sup>[[1]](https://github.com/langgenius/dify/blob/main/docker/.env.example)</sup><sup>[[2]](https://github.com/langgenius/dify/issues/13875)</sup>. If the issue persists, you might want to check your logs for any specific error messages that could provide more insight into the cause of the shutdown. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/b7f77eda-8d93-4a5e-9d9a-4b58930b30c5?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/b7f77eda-8d93-4a5e-9d9a-4b58930b30c5?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/b7f77eda-8d93-4a5e-9d9a-4b58930b30c5?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/b7f77eda-8d93-4a5e-9d9a-4b58930b30c5?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b7f77eda-8d93-4a5e-9d9a-4b58930b30c5?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/b7f77eda-8d93-4a5e-9d9a-4b58930b30c5?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b7f77eda-8d93-4a5e-9d9a-4b58930b30c5?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#14069