mod_wsgi
mod_wsgi copied to clipboard
Apache and mod_wsgi, worker process stuck to W state, request never dies.
I am running Apache 2.4.51 with mod_wsgi, Python 3.10 but request never dies and waiting for response. I do not have this problem with Python 3.9.7
python3.10 apache 2.4.51 Django 3.2.8
Impossible to tell from the information you have provided.
What do you mean by "but request never dies and waiting for response"? Do you mean never returns a response and just hangs?
If so read:
- https://modwsgi.readthedocs.io/en/master/user-guides/application-issues.html#python-simplified-gil-state-api
and ensure you are forcing use of the main Python sub interpreter context if manually configuring Apache yourself.
In order to help further I would need to see how you configured mod_wsgi in the Apache configuration file if you are doing it manually. In other words, what you included in your VirtualHost definition. If not doing it manually and you are instead using mod_wsgi-express start-server, I would need to know how you are running that.
Hi, yes,never returns a response and just hangs this is my config:
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /home/mohammad/django-bookstore/
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/mohammad/django-bookstore/staticfiles
<Directory /home/mohammad/django-bookstore/staticfiles>
Require all granted
</Directory>
Alias /media /home/mohammad/django-bookstore/media
<Directory /home/mohammad/django-bookstore/media>
Require all granted
</Directory>
<Directory /home/mohammad/django-bookstore/myproject>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess django-bookstore python-path=/home/mohammad/django-bookstore python-home=/home/mohammad/django-bookstore/venv
WSGIProcessGroup django-bookstore
WSGIScriptAlias / /home/mohammad/django-bookstore/myproject/wsgi.py
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
but I do not have this problem with Python 3.9 or python3.8
As explained in that document I pointed you at, add:
WSGIApplicationGroup %{GLOBAL}
It is always recommended to use this and combats problems with third party Python packages that use a C extension which isn't designed to work in a Python sub interpreter. It is likely when updating you started pulling in a newer version of some package that now suffers this issue.
Thanks!!! I suffered for three days ... It helped !!!!!