#28835: Development server doesn't shut down on SIGTERM
-------------------------------------+-------------------------------------
Reporter: Slavek | Owner: nobody
Kabrda |
Type: Bug | Status: new
Component: Core | Version: 1.11
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Hi, I've already opened a PR to fix this [1], but have been notified in a
comment that I'll need to open a Trac ticket, so here it is. The
explanation of this issue is at [1], but I'll C&P it here as well for
clarity:
I've run into an issue where shutting down django devserver in a container
(e.g. in kubernetes/openshift environment) doesn't work well. The original
report is at [2].
Explanation:
* kubernetes/openshift send SIGTERM to PID 1 in the container when
shutting the container down.
* If `manage.py runserver` is an entrypoint, it gets executed as PID 1 in
container.
* Linux kernel won't propagate SIGTERM to any process that is PID 1 (in or
outside of container) if it doesn't have a handler installed for this
signal.
The implication of this is that the container with django devserver will
not do "soft" shutdown on SIGTERM and Kubernetes/Openshift will wait for
timeout and kill the container with SIGKILL. Therefore the container will
keep hanging and occupying system resources during the whole timeout.
Even though I understand that people should only use devserver for
development and not for deployment, I think it's quite common to first
make the container working with devserver for development and then
consider Gunicorn or similar solution when moving from early stage of the
project. IOW, I think this would really be beneficial for people using
Kubernetes like environments to develop/deploy Django apps.
Thanks for considering!
[1] https://github.com/django/django/pull/9338
[2] https://github.com/sclorg/s2i-python-container/issues/93
--
Ticket URL: <https://code.djangoproject.com/ticket/28835>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.944a16906a6e2ebda32768707d115d31%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.