Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - UVICORN_WORKERS > 1 hangs Mealie on start #4354

Closed
5 of 6 tasks
ndbeals opened this issue Oct 12, 2024 · 4 comments
Closed
5 of 6 tasks

[BUG] - UVICORN_WORKERS > 1 hangs Mealie on start #4354

ndbeals opened this issue Oct 12, 2024 · 4 comments
Labels
bug Something isn't working triage

Comments

@ndbeals
Copy link

ndbeals commented Oct 12, 2024

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue (title field is above this).
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

When setting UVICORN_WORKERS=2, mealie can no longer start up.

It gets caught in an endless loop of "waiting for child process" and then "child process died" and repeat

Steps to Reproduce

Set UVICORN_WORKERS=2 and start mealie up.

I am using the postgres17 as my database.

Please provide relevant logs

Switching to dedicated user

        User uid:    1000
        User gid:    1000

INFO     2024-10-12T14:15:46 - Uvicorn running on http://0.0.0.0:9000 (Press CTRL+C to quit)
INFO     2024-10-12T14:15:46 - Started parent process [1]
INFO     2024-10-12T14:15:52 - Waiting for child process [53]
INFO     2024-10-12T14:15:52 - Child process [53] died
INFO     2024-10-12T14:15:57 - Waiting for child process [54]
INFO     2024-10-12T14:15:57 - Child process [54] died
INFO     2024-10-12T14:16:03 - Waiting for child process [55]
INFO     2024-10-12T14:16:03 - Child process [55] died
INFO     2024-10-12T14:16:08 - Waiting for child process [56]
INFO     2024-10-12T14:16:08 - Child process [56] died
INFO     2024-10-12T14:16:13 - Waiting for child process [57]

Mealie Version

ghcr.io/mealie-recipes/mealie:v1.12.0

Deployment

Docker (Linux)

Additional Deployment Details

No response

@ndbeals ndbeals added bug Something isn't working triage labels Oct 12, 2024
@ndbeals
Copy link
Author

ndbeals commented Oct 12, 2024

I know my setup is a little different from the default, so I tried with the default postgres docker compose from your documentation, it also has the same issue, here's the docker-compose I used:

services:
  mealie:
    image: ghcr.io/mealie-recipes/mealie:v1.12.0
    container_name: mealie-test
    restart: always
    ports:
        - "9925:9000" # 
    deploy:
      resources:
        limits:
          memory: 1000M # 
    volumes:
      - mealie-data:/app/data/
    environment:
      # Set Backend ENV Variables Here
      ALLOW_SIGNUP: "false"
      PUID: 1000
      PGID: 1000
      TZ: America/Toronto
      UVICORN_WORKERS: 2
      MAX_WORKERS: 1
      WEB_CONCURRENCY: 1
      BASE_URL: https://mealie.yourdomain.com
      # Database Settings
      DB_ENGINE: postgres
      POSTGRES_USER: mealie
      POSTGRES_PASSWORD: mealie
      POSTGRES_SERVER: postgres
      POSTGRES_PORT: 5432
      POSTGRES_DB: mealie
    depends_on:
      postgres:
        condition: service_healthy

  postgres:
    container_name: postgres-test
    image: postgres:15
    restart: always
    volumes:
      - mealie-pgdata:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: mealie
      POSTGRES_USER: mealie
    healthcheck:
      test: ["CMD", "pg_isready"]
      interval: 30s
      timeout: 20s
      retries: 3

volumes:
  mealie-data:
  mealie-pgdata:

@ndbeals
Copy link
Author

ndbeals commented Oct 12, 2024

This issue is also present when using sqlite

@ndbeals
Copy link
Author

ndbeals commented Oct 12, 2024

This appears to be a bug in uvicorn, fixed by this MR: encode/uvicorn#2373

fix was released in 0.30.2: encode/uvicorn#2380

mealie is on unicorn v0.30.0

@michael-genson
Copy link
Collaborator

Thanks for the investigation! Nightly is on the latest version of uvicorn so it should be fixed in the next release. If you need it now you can upgrade to nightly in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants