langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
48.43k stars 6.92k forks source link

api service alway restart #9403

Closed jonzha9527 closed 2 days ago

jonzha9527 commented 2 days ago

Self Checks

Dify version

0.9.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Docker Compose version v2.21.0 docker compose start api service, and console log as below:

docker-api-1  | Running migrations
docker-api-1  | None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
docker-api-1  | sagemaker.config INFO - Not applying SDK defaults from location: /etc/xdg/sagemaker/config.yaml
docker-api-1  | sagemaker.config INFO - Not applying SDK defaults from location: /root/.config/sagemaker/config.yaml
docker-api-1  | INFO:matplotlib.font_manager:generated new fontManager
docker-api-1  | /entrypoint.sh: line 8:     7 Killed                  flask upgrade-db
docker-api-1  | Running migrations
docker-api-1  | None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
docker-api-1  | sagemaker.config INFO - Not applying SDK defaults from location: /etc/xdg/sagemaker/config.yaml
docker-api-1  | sagemaker.config INFO - Not applying SDK defaults from location: /root/.config/sagemaker/config.yaml
docker-api-1  | Preparing database migration...
docker-api-1  | /entrypoint.sh: line 8:     7 Killed                  flask upgrade-db
docker-api-1 exited with code 0

✔️ Expected Behavior

api serivce running normally

❌ Actual Behavior

api service restart again and again, cpu be used by celery and gunicorn more than 50%.

dosubot[bot] commented 2 days ago

Hey, @jonzha9527! 👋 I'm here to help you with bugs, questions, and becoming a contributor. Let's squash those bugs together!

I couldn't find any specific issues related to Dify version 0.9.2 that could cause the API service to restart. However, there are a few things you might want to consider:

  1. Missing Dependencies: The logs indicate that PyTorch, TensorFlow, or Flax are not found. This might be causing issues if your application relies on these libraries. Ensure that these dependencies are installed in your Docker environment if they are required for your application.

  2. Resource Constraints: High CPU usage by Celery and Gunicorn could indicate that the system is under heavy load or not properly configured. Make sure your system meets the minimum requirements: at least 2 CPU cores and 4GB of RAM. For macOS, it's recommended to allocate at least 2 virtual CPUs and 8GB of memory to Docker [1][2].

  3. Configuration Issues: Check your Docker Compose and environment variable configurations. Ensure that the number of workers for Gunicorn and Celery is set appropriately for your system's resources. Celery and Gunicorn configurations can significantly impact CPU usage [3][4].

  4. Entrypoint Script: The error /entrypoint.sh: line 8: 7 Killed flask upgrade-db suggests that the flask upgrade-db command is being killed, possibly due to resource constraints. You might want to investigate why this command is failing and ensure that your database is properly configured and accessible.

If these suggestions do not resolve the issue, you might want to look into similar discussions or issues for additional insights. For example, there is a closed issue related to Docker upgrade run errors that might provide some context [5].

To continue talking to Dosu, mention @dosu.