epoz / shmarql

SPARQL endpoint explorer
The Unlicense
13 stars 2 forks source link

uvicorn `Child process died` #21

Open ch-sander opened 2 weeks ago

ch-sander commented 2 weeks ago

https://github.com/epoz/shmarql/blob/8811fddb8f7f4b104e504437564616cd2f290776/Dockerfile#L39

When loading from store (and only if building the Docker image locally) the worker fails (snippet):

shmarql_dev  | 2024-08-25 21:22:53 DEBUG    Opening store from /data/store
shmarql_dev  | 2024-08-25 21:22:53 DEBUG    Opening store from /data/store
shmarql_dev  | 2024-08-25 21:22:53 DEBUG    Opening store read-only
shmarql_dev  | 2024-08-25 21:22:53 DEBUG    Opening store read-only
shmarql_dev  | 2024-08-25 21:22:53 DEBUG    Opening store from /data/store
shmarql_dev  | 2024-08-25 21:22:53 DEBUG    Opening store from /data/store
shmarql_dev  | 2024-08-25 21:22:53 DEBUG    Opening store read-only
shmarql_dev  | 2024-08-25 21:22:53 DEBUG    Opening store read-only
shmarql_dev  | INFO:     Waiting for child process [8]
shmarql_dev  | INFO:     Child process [8] died
shmarql_dev  | INFO:     Waiting for child process [9]
shmarql_dev  | INFO:     Child process [9] died

Loading from ttl works.

It also works if I run just one worker per CMD ["uvicorn", "--workers", "1", "--host", "0.0.0.0", "--port", "8000", "app:app", "--log-level", "debug" ]

Very odd. Any idea why that is?

Maybe the uvicorn library has changed meanwhile (and is on an older version in origin docker image at ghcr.io/epoz/shmarql:latest)? https://github.com/epoz/shmarql/blob/8811fddb8f7f4b104e504437564616cd2f290776/requirements.txt#L3

ch-sander commented 2 weeks ago

Running uvicorn 0.29.0 with CPython 3.9.7 on Linux for ghcr.io/epoz/shmarql:latest. If changed in https://github.com/epoz/shmarql/blob/8811fddb8f7f4b104e504437564616cd2f290776/requirements.txt#L3, problem solved.

Still, something to look out for.

epoz commented 2 weeks ago

In uvicorn 0.30 a new multiprocess manager was released, and this caused breakage in shmarql with the uvicorn parent process just dying. I had to pin the uvicorn to 0.29 at the time, as all newer versions were showing this behaviour.

It looks like newer versions have now fixed this, so we can probably start using the newer versions, but we will have to pin to something a bit higher. To be tested...