Timeout Error When Adding Ollama Model in Dify 1.1.0 (PluginDaemonInternalServerError: killed by timeout) #647 #11903

Closed
opened 2026-02-21 19:04:39 -05:00 by yindo · 1 comment
Owner

Originally created by @zanghaibin on GitHub (Mar 20, 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.1.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When attempting to integrate an Ollama model with Dify v1.1.0, the system throws a timeout error during credential validation. The error occurs specifically when calling the /console/api/workspaces/current/model-providers/langgenius/ollama/ollama/models endpoint.

2025-03-20 12:57:21.622 ERROR [Dummy-8] [app.py:875] - Exception on /console/api/workspaces/current/model-providers/langgenius/ollama/ollama/models [POST] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 489, in wrapper resp = resource(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request resp = meth(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 187, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/libs/login.py", line 94, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 30, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/workspace/models.py", line 154, in post model_provider_service.save_model_credentials( File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials provider_configuration.add_or_update_custom_model_credentials( File "/app/api/core/entities/provider_configuration.py", line 422, in add_or_update_custom_model_credentials provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/entities/provider_configuration.py", line 402, in custom_model_credentials_validate credentials = model_provider_factory.model_credentials_validate( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 191, in model_credentials_validate self.plugin_model_manager.validate_model_credentials( File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials for resp in response: ^^^^^^^^ File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream self._handle_plugin_daemon_error(error.error_type, error.message) File "/app/api/core/plugin/manager/base.py", line 223, in _handle_plugin_daemon_error raise PluginDaemonInternalServerError(description=message) core.plugin.manager.exc.PluginDaemonInternalServerError: PluginDaemonInternalServerError: killed by timeout

Image

✔️ Expected Behavior

When adding the Ollama model in Dify 1.1.0, the system should validate the credentials and connect to the Ollama service successfully.

Actual Behavior

The validation process times out after ~30 seconds, throwing a error.

Originally created by @zanghaibin on GitHub (Mar 20, 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.1.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When attempting to integrate an Ollama model with Dify v1.1.0, the system throws a timeout error during credential validation. The error occurs specifically when calling the /console/api/workspaces/current/model-providers/langgenius/ollama/ollama/models endpoint. ` 2025-03-20 12:57:21.622 ERROR [Dummy-8] [app.py:875] - Exception on /console/api/workspaces/current/model-providers/langgenius/ollama/ollama/models [POST] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 489, in wrapper resp = resource(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request resp = meth(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 187, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/libs/login.py", line 94, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 30, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/workspace/models.py", line 154, in post model_provider_service.save_model_credentials( File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials provider_configuration.add_or_update_custom_model_credentials( File "/app/api/core/entities/provider_configuration.py", line 422, in add_or_update_custom_model_credentials provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/entities/provider_configuration.py", line 402, in custom_model_credentials_validate credentials = model_provider_factory.model_credentials_validate( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 191, in model_credentials_validate self.plugin_model_manager.validate_model_credentials( File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials for resp in response: ^^^^^^^^ File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream self._handle_plugin_daemon_error(error.error_type, error.message) File "/app/api/core/plugin/manager/base.py", line 223, in _handle_plugin_daemon_error raise PluginDaemonInternalServerError(description=message) core.plugin.manager.exc.PluginDaemonInternalServerError: PluginDaemonInternalServerError: killed by timeout ` ![Image](https://github.com/user-attachments/assets/7d6c9ba6-9a2c-416a-b7a0-74472412b036) ### ✔️ Expected Behavior When adding the Ollama model in Dify 1.1.0, the system should validate the credentials and connect to the Ollama service successfully. ### ❌ Actual Behavior The validation process times out after ~30 seconds, throwing a error.
yindo added the 🐞 bug label 2026-02-21 19:04:39 -05:00
yindo closed this issue 2026-02-21 19:04:39 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 20, 2025):

To resolve the 'PluginDaemonInternalServerError: killed by timeout' error when adding an Ollama model in Dify 1.1.0 during credential validation, you should increase the execution timeout limit. Add or modify the following environment variables in your docker-compose.yaml file for the plugin_daemon service:

plugin_daemon:
  environment:
    PLUGIN_MAX_EXECUTION_TIMEOUT: 2400
    PYTHON_ENV_INIT_TIMEOUT: 320

After making these changes, restart your Docker containers using the following commands:

docker compose stop
docker compose up -d

This increases the timeout limit to allow for longer model validation and credential saving processes. Additionally, ensure that the following environment variables are set in your .env file:

PROVIDER_OLLAMA_API_BASE_URL=http://host.docker.internal:11434/
PLUGIN_WORKING_PATH=/app/cwd

If you are using Windows, consider moving the dify/docker directory to the WSL filesystem instead of keeping it on Windows NTFS. If you are using a proxy like Clash, enable global TUN mode. Note that this solution may not work for all model providers, and some providers like Volcengine may still experience issues even with the increased timeout [1].

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 (Mar 20, 2025): <!-- Answer --> To resolve the 'PluginDaemonInternalServerError: killed by timeout' error when adding an Ollama model in Dify 1.1.0 during credential validation, you should increase the execution timeout limit. Add or modify the following environment variables in your `docker-compose.yaml` file for the `plugin_daemon` service: ```yaml plugin_daemon: environment: PLUGIN_MAX_EXECUTION_TIMEOUT: 2400 PYTHON_ENV_INIT_TIMEOUT: 320 ``` After making these changes, restart your Docker containers using the following commands: ```bash docker compose stop docker compose up -d ``` This increases the timeout limit to allow for longer model validation and credential saving processes. Additionally, ensure that the following environment variables are set in your `.env` file: ```plaintext PROVIDER_OLLAMA_API_BASE_URL=http://host.docker.internal:11434/ PLUGIN_WORKING_PATH=/app/cwd ``` If you are using Windows, consider moving the dify/docker directory to the WSL filesystem instead of keeping it on Windows NTFS. If you are using a proxy like Clash, enable global TUN mode. Note that this solution may not work for all model providers, and some providers like Volcengine may still experience issues even with the increased timeout <sup>[[1]](https://github.com/langgenius/dify/issues/15538)</sup>. <!-- 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/eb24bee1-1cfc-456f-b665-8f50c60d241f?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/eb24bee1-1cfc-456f-b665-8f50c60d241f?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/eb24bee1-1cfc-456f-b665-8f50c60d241f?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/eb24bee1-1cfc-456f-b665-8f50c60d241f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/eb24bee1-1cfc-456f-b665-8f50c60d241f?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/eb24bee1-1cfc-456f-b665-8f50c60d241f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/eb24bee1-1cfc-456f-b665-8f50c60d241f?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#11903