mealie-recipes / mealie

Mealie is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and mealie will automatically import the relevant data or add a family recipe with the UI editor
https://docs.mealie.io
GNU Affero General Public License v3.0
6.85k stars 703 forks source link

[v1.0.0b] - API crash on opening setting pages #1092

Closed s-croot closed 2 years ago

s-croot commented 2 years ago

First Check

What is the issue you are experiencing?

I experience frequent crashes of the API service when adjusting settings or calling for data. In the case in the logs below I was opening the manage data page. The page will open but no foods are displayed. The logs show a failed call to the API in the frontend container and a crash of the service in the API container although I believe the error shown in the frontend logs happens before the API crash. When the API service restarts the incomplete setting changes are made and data is delivered after around 30-60 seconds.

Frontend logs: ``` {"level":"info","ts":1648072335.6925678,"msg":"using provided configuration","config_file":"/app/Caddyfile","config_adapter":""}, {"level":"warn","ts":1648072335.6963153,"msg":"input is not formatted with 'caddy fmt'","adapter":"caddyfile","file":"/app/Caddyfile","line":30}, {"level":"warn","ts":1648072335.7038846,"logger":"admin","msg":"admin endpoint disabled"}, {"level":"info","ts":1648072335.704122,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0000d0000"}, {"level":"info","ts":1648072335.7047305,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/root/.local/share/caddy"}, {"level":"info","ts":1648072335.7047615,"logger":"tls","msg":"finished cleaning storage units"}, {"level":"info","ts":1648072335.7049673,"msg":"autosaved config (load with --resume flag)","file":"/root/.config/caddy/autosave.json"}, {"level":"info","ts":1648072335.7049725,"msg":"serving initial configuration"}, Successfully started Caddy (pid=15) - Caddy is running in the background, yarn run v1.22.18, $ nuxt start -p 3001, ℹ [HPM] Proxy created: api -> http://mealie-api:9000, ℹ [HPM] Proxy rewrite rule created: "api" ~> "/api", ℹ [HPM] Proxy created: /api -> http://mealie-api:9000, ℹ Listening on: http://172.18.0.5:3001/, ERROR [HPM] Error occurred while proxying request mealie.mydomain.net/api/admin/about to http://mealie-api:9000/ [ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors), ERROR [HPM] Error occurred while proxying request mealie.mydomain.net/api/admin/about/check to http://mealie-api:9000/ [ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors) ```
API Logs: ``` 172.18.0.5:34122 - "GET /api/users/self HTTP/1.1" 200, 172.18.0.5:34120 - "POST /api/users/aee5f787-35fd-4118-8b50-3bf3e0bb8d19/favorites/spicy-sichuan-dan-dan-noodles HTTP/1.1" 200, 172.18.0.5:34118 - "GET /api/recipes?start=0&limit=30 HTTP/1.1" 200, 127.0.0.1:40894 - "GET /docs HTTP/1.1" 200, 172.18.0.5:34124 - "PATCH /api/recipes/spicy-sichuan-dan-dan-noodles HTTP/1.1" 200, 172.18.0.5:34126 - "PATCH /api/recipes/spicy-sichuan-dan-dan-noodles HTTP/1.1" 200, 172.18.0.5:34128 - "PATCH /api/recipes/spicy-sichuan-dan-dan-noodles HTTP/1.1" 200, [2022-03-23 22:00:29 +0000] [30] [CRITICAL] WORKER TIMEOUT (pid:61), [2022-03-23 22:00:29 +0000] [30] [WARNING] Worker with pid 61 was terminated due to signal 6, [2022-03-23 22:00:29 +0000] [171] [INFO] Booting worker with pid: 171, [2022-03-23 22:00:29 +0000] [171] [INFO] Started server process [171], [2022-03-23 22:00:29 +0000] [171] [INFO] Waiting for application startup., /opt/pysetup/.venv/lib/python3.10/site-packages/apscheduler/util.py:95: PytzUsageWarning: The zone attribute is specific to pytz's interface; please migrate to a new time zone provider. For more details on how to do so, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html, if obj.zone == 'local':, INFO: 23-Mar-22 22:00:29 Adding job tentatively -- it will be properly scheduled when the scheduler starts, return self.timezone.normalize(next_fire_time), /opt/pysetup/.venv/lib/python3.10/site-packages/apscheduler/triggers/interval.py:66: PytzUsageWarning: The normalize method is no longer necessary, as this time zone supports the fold attribute (PEP 495). For more details on migrating to a PEP 495-compliant implementation, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html, INFO: 23-Mar-22 22:00:29 Added job "run_daily" to job store "default", INFO: 23-Mar-22 22:00:29 Added job "run_hourly" to job store "default", INFO: 23-Mar-22 22:00:29 Added job "run_minutely" to job store "default", INFO: 23-Mar-22 22:00:29 Scheduler started, INFO: 23-Mar-22 22:00:29 Registering daily callback: purge_group_registration, INFO: 23-Mar-22 22:00:29 Registering daily callback: auto_backup, INFO: 23-Mar-22 22:00:29 Registering daily callback: purge_password_reset_tokens, INFO: 23-Mar-22 22:00:29 Registering daily callback: purge_group_data_exports, INFO: 23-Mar-22 22:00:29 Registering minutely callback: update_group_webhooks, Jobstore default:, run_minutely (trigger: interval[0:15:00], next run at: 2022-03-23 22:15:29 GMT), run_hourly (trigger: interval[1:00:00], next run at: 2022-03-23 23:00:29 GMT), run_daily (trigger: interval[1 day, 0:00:00], next run at: 2022-03-24 22:00:29 GMT), INFO: 23-Mar-22 22:00:29 -----SYSTEM STARTUP----- , INFO: 23-Mar-22 22:00:29 None, INFO: 23-Mar-22 22:00:29 ------APP SETTINGS------, INFO: 23-Mar-22 22:00:29 {, "PRODUCTION": true,, "BASE_URL": "http://localhost:8080",, "IS_DEMO": false,, "API_PORT": 9000,, "API_DOCS": true,, "ALLOW_SIGNUP": true,, "TOKEN_TIME": 48,, "DB_ENGINE": "sqlite",, "DB_PROVIDER": {, "data_dir": "/app/data",, "prefix": "", },, "DEFAULT_GROUP": "Home",, "DEFAULT_EMAIL": "changeme@email.com",, "SMTP_HOST": null,, "SMTP_PORT": "587",, "SMTP_FROM_NAME": "Mealie",, "SMTP_TLS": true,, "SMTP_FROM_EMAIL": null,, "LDAP_AUTH_ENABLED": false,, "LDAP_SERVER_URL": null,, "LDAP_BIND_TEMPLATE": null,, "LDAP_ADMIN_FILTER": null,, "TESTING": false, }, [2022-03-23 22:00:29 +0000] [171] [INFO] Application startup complete., 127.0.0.1:40898 - "GET /docs HTTP/1.1" 200, 127.0.0.1:40900 - "GET /docs HTTP/1.1" 200, 172.18.0.5:34136 - "GET /api/organizers/tags?start=0&limit=9999 HTTP/1.1" 200, 172.18.0.5:34134 - "GET /api/organizers/categories?start=0&limit=9999 HTTP/1.1" 200, 172.18.0.5:34150 - "GET /api/groups/labels?start=0&limit=9999 HTTP/1.1" 200, 172.18.0.5:34152 - "GET /api/foods?start=0&limit=9999 HTTP/1.1" 200, 172.18.0.5:34154 - "GET /api/units?start=0&limit=9999 HTTP/1.1" 200, 172.18.0.5:34144 - "POST /api/groups/cookbooks HTTP/1.1" 201 ```

Deployment

Docker (Linux)

Deployment Details

Docker running in Ubuntu 20.04 Accessed through Nginx reverse proxy from mealie.mydomain.com The container images were pulled just now

hay-kot commented 2 years ago

Can you provide your docker-compose file and what hardware you're running on?

s-croot commented 2 years ago

Hardware: Dell Optiplex 3050 SFF i5-7500 8GB RAM OS and Docker running from 256GB SSD Also has Home Assistant running in a VM with 1 core and 2GB RAM

docker-compose.yml:

---
version: "3.7"
networks:
  frontend:
    external: true
  backend:
    external: true
services:
  mealie-frontend:
    image: hkotel/mealie:frontend-nightly
    container_name: mealie-frontend
    environment:
    # Set Frontend ENV Variables Here
      - ALLOW_SIGNUP=true
      - API_URL=http://mealie-api:9000

    restart: always
#    ports:
#      - 9925:3000
    networks:
      - frontend
      - backend
    volumes:
      - mealie-data:/app/data/

  mealie-api:
    image: hkotel/mealie:api-nightly
    container_name: mealie-api
    volumes:
      - mealie-data:/app/data/
    environment:
    # Set Backend ENV Variables Here
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - MAX_WORKERS=1
      - WEB_CONCURRENCY=1
      - BASE_URL=http://localhost:8080
    restart: always
    networks:
     - backend
volumes:
  mealie-data:
    driver: local
hay-kot commented 2 years ago

Pretty stumped on this one - I don't see anything that stands out and I haven't had an thing like this happen on the 3 instances I'm running.

s-croot commented 2 years ago

I've not experienced this error for the past week or so. One possible cause of the problem may have been that the API container was not able to reach the internet as it was connected to my backend network. I only noticed this when I found that importing recipes by URL was not functional. It hadn't occurred to me that an internet connection might cause the API container to crash on local tasks. Around a week ago I connected both containers to my internet connected network and I haven't experienced either problem since.

hay-kot commented 2 years ago

One possible cause of the problem may have been that the API container was not able to reach the internet as it was connected to my backend network.

Ahhhhhhhh. I think I have an idea on what's going on. I make a call to github to check the newest version to see if there's an update. I thought I handled errors gracefully if no connection could be made, but maybe not. Will give it a look and update. Thanks for following up!

hay-kot commented 2 years ago

Hey this should be fixed in the latest build!