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

uvicorn Child process died #21

Closed
ch-sander opened this issue Aug 25, 2024 · 6 comments
Closed

uvicorn Child process died #21

ch-sander opened this issue Aug 25, 2024 · 6 comments

Comments

@ch-sander
Copy link
Contributor

CMD ["uvicorn", "--workers", "4", "--host", "0.0.0.0", "--port", "8000", "app:app", "--log-level", "debug" ]

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)?

uvicorn>=0.11.3

@ch-sander
Copy link
Contributor Author

Running uvicorn 0.29.0 with CPython 3.9.7 on Linux for ghcr.io/epoz/shmarql:latest. If changed in

uvicorn>=0.11.3
, problem solved.

Still, something to look out for.

@epoz
Copy link
Owner

epoz commented Aug 26, 2024

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...

@epoz epoz closed this as completed in 78426db Sep 30, 2024
@ahirner
Copy link

ahirner commented Oct 15, 2024

I see it pinned to 0.29.

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...

Did you test higher versions @epoz ?

@epoz
Copy link
Owner

epoz commented Oct 16, 2024

@ahirner - not extensively, there was no need for me to use a higher version yet.

Please note that I have started working on a re-boot of shmarql in fasthtml which brings several improvements.

May I ask, are you using shmarql for anything that I should be aware of with regards to breaking changes, or backwards compatibility? To date I thought there was not that many other users.

@ahirner
Copy link

ahirner commented Oct 16, 2024

Thanks! We are see the same error in a django app of ours. 0.29 can't restart workers (ignores SIGHUP), workers with later versions die. I was mainly looking for hints how to reproduce that, unfortunately no user of shmarql :)

PS: as we speak, we found that granian doesn't suffer from dying workes and can restart them gracefully.

@epoz
Copy link
Owner

epoz commented Oct 16, 2024

Ah, clear...
FastAPI did work with later versions of uvicorn when I tested it informally, so yes, it seemed this was sorted. But to be on the safe side I left the version pinned in my repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants