--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/02fb2171-ca59-4053-9be3-8ff75e9cf9edn%40googlegroups.com.
Defines the maximum number of seconds allowed to pass before the daemon process is shutdown and restarted after a potential deadlock on the Python GIL has been detected. The default is 300 seconds.
This option exists to combat the problem of a daemon process freezing as the result of a rogue Python C extension module which doesn’t properly release the Python GIL when entering into a blocking or long running operation.
Defines the maximum number of seconds that a request is allowed to run before the daemon process is restarted. This can be used to recover from a scenario where a request blocks indefinitely, and where if all request threads were consumed in this way, would result in the whole WSGI application process being blocked.
How this option is seen to behave is different depending on whether a daemon process uses only one thread, or more than one thread for handling requests, as set by the threads
option.
If there is only a single thread, and so the process can only handle one request at a time, as soon as the timeout has passed, a restart of the process will be initiated.
If there is more than one thread, the request timeout is applied to the average running time for any requests, across all threads. This means that a request can run longer than the request timeout. This is done to reduce the possibility of interupting other running requests, and causing a user to see a failure. So where there is still capacity to handle more requests, restarting of the process will be delayed if possible.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/a3ede6cc-dfd2-423a-a8e0-55068433afcen%40googlegroups.com.
Hello Graham,
many thanks for your detailed reply!
I must add that my Django project is a simple webcam application: A webcam sends POST requests to upload the images, the views show them. A single webcam is connected over a very slow internet connection (32 kBit/s), so a single POST can take several minutes. However, that never was and still doesn't seem to be a problem: Uploads still succeed, it's only the GET requests that fail. The GET requests in turn do more than just sending some HTML with the image URLs: especially they use the Pillow library to lazily produce thumbnails, put timestamps into the images, etc.
Therefore I thought that Pillow (9.4.0) might be the culprit, so
I removed the related code, made a new virtuelenv without Pillow
from scratch and restarted Apache. Unfortunately, it didn't help –
please see the error log below. The timeout occurs only after the
browser has received a large portion, possibly all, of the view's
response.
`pip list` shows
Package Version
-------------------- -------
asgiref 3.6.0
Django 4.1.5
django-improved-user 2.0a2
django-widget-tweaks 1.4.12
pip 22.0.2
python-dateutil 2.8.2
setuptools 59.6.0
six 1.16.0
sqlparse 0.4.3
Is any of these know for causing problems like numpy?
Best regards,
Carsten
The above mentioned error log:
[Mon Feb 06 20:52:20.329545 2023]
[mpm_event:notice] [pid 25844:tid 140714434877312] AH00489:
Apache/2.4.52 (Ubuntu) mod_wsgi/4.9.0 Python/3.10 configured --
resuming normal operations
[Mon Feb 06 20:52:20.330207 2023] [core:notice] [pid 25844:tid
140714434877312] AH00094: Command line: '/usr/sbin/apache2'
[Mon Feb 06 20:52:20.380741 2023] [wsgi:info] [pid 25845:tid
140714434877312] mod_wsgi (pid=25845): Attach interpreter ''.
[Mon Feb 06 20:52:20.395024 2023] [wsgi:info] [pid 25846:tid
140714434877312] mod_wsgi (pid=25846): Attach interpreter ''.
[Mon Feb 06 20:52:20.395771 2023] [wsgi:info] [pid 25845:tid
140714434877312] mod_wsgi (pid=25845): Adding
'/home/carsten/HallCam/web' to path.
[Mon Feb 06 20:52:20.411711 2023] [wsgi:info] [pid 25846:tid
140714434877312] mod_wsgi (pid=25846): Adding
'/home/carsten/HallCam/web' to path.
[Mon Feb 06 20:52:48.621284 2023] [wsgi:info] [pid 25845:tid
140714369189440] mod_wsgi (pid=25845): Create interpreter
'192.168.1.222:32228|'.
[Mon Feb 06 20:52:48.634464 2023] [wsgi:info] [pid 25845:tid
140714369189440] mod_wsgi (pid=25845): Adding
'/home/carsten/HallCam/web' to path.
[Mon Feb 06 20:52:48.635248 2023] [wsgi:info] [pid 25845:tid
140714369189440] [remote 88.75.25.178:42162] mod_wsgi
(pid=25845, process='cf-hallcam-site',
application='192.168.1.222:32228|'): Loading Python script file
'/home/carsten/HallCam/web/HallCam/wsgi.py'.
[Mon Feb 06 20:57:40.661043 2023] [wsgi:info] [pid 25845:tid
140714419545664] mod_wsgi (pid=25845): Daemon process request
time limit exceeded, stopping process 'cf-hallcam-site'.
[Mon Feb 06 20:57:40.661184 2023] [wsgi:info] [pid 25845:tid
140714434877312] mod_wsgi (pid=25845): Shutdown requested
'cf-hallcam-site'.
[Mon Feb 06 20:57:45.661421 2023] [wsgi:info] [pid 25845:tid
140714177934912] mod_wsgi (pid=25845): Aborting process
'cf-hallcam-site'.
[Mon Feb 06 20:57:45.661464 2023] [wsgi:info] [pid 25845:tid
140714177934912] mod_wsgi (pid=25845): Exiting process
'cf-hallcam-site'.
[Mon Feb 06 20:57:45.666987 2023] [wsgi:error] [pid 25847:tid
140714226689600] [client 37.81.109.237:49940] Truncated or
oversized response headers received from daemon process
'cf-hallcam-site': /home/carsten/HallCam/web/HallCam/wsgi.py
[Mon Feb 06 20:57:45.667005 2023] [wsgi:error] [pid 25848:tid
140714335794752] (104)Connection reset by peer: [client
88.75.25.178:42162] mod_wsgi (pid=25848): Failed to proxy
response from daemon., referer:
http://vdzuggmrroo5k7e9.myfritz.net:32228/
[Mon Feb 06 20:57:46.621804 2023] [wsgi:info] [pid 25977:tid
140714434877312] mod_wsgi (pid=25977): Attach interpreter ''.
[Mon Feb 06 20:57:46.633564 2023] [wsgi:info] [pid 25977:tid
140714434877312] mod_wsgi (pid=25977): Adding
'/home/carsten/HallCam/web' to path.
[Mon Feb 06 21:00:01.811479 2023] [wsgi:info] [pid 25846:tid
140714360796736] mod_wsgi (pid=25846): Create interpreter
'192.168.1.222:32228|'.
[Mon Feb 06 21:00:01.824795 2023] [wsgi:info] [pid 25846:tid
140714360796736] mod_wsgi (pid=25846): Adding
'/home/carsten/HallCam/web' to path.
[Mon Feb 06 21:00:01.825535 2023] [wsgi:info] [pid 25846:tid
140714360796736] [remote 37.81.109.237:49942] mod_wsgi
(pid=25846, process='cf-hallcam-site',
application='192.168.1.222:32228|'): Loading Python script file
'/home/carsten/HallCam/web/HallCam/wsgi.py'.
[Mon Feb 06 21:00:02.506063 2023] [wsgi:info] [pid 25977:tid
140714402760256] mod_wsgi (pid=25977): Create interpreter
'192.168.1.222:32228|'.
[Mon Feb 06 21:00:02.519453 2023] [wsgi:info] [pid 25977:tid
140714402760256] mod_wsgi (pid=25977): Adding
'/home/carsten/HallCam/web' to path.
[Mon Feb 06 21:00:02.520239 2023] [wsgi:info] [pid 25977:tid
140714402760256] [remote 88.75.25.178:43650] mod_wsgi
(pid=25977, process='cf-hallcam-site',
application='192.168.1.222:32228|'): Loading Python script file
'/home/carsten/HallCam/web/HallCam/wsgi.py'.
[Mon Feb 06 21:00:03.299821 2023] [core:info] [pid 25847:tid
140714151155264] [client 88.75.25.178:43652] AH00128: File does
not exist:
/var/www/HallCam-media/thumbs/camera-2/pic_20230206_205532_4.jpg,
referer: http://vdzuggmrroo5k7e9.myfritz.net:32228/
[Mon Feb 06 21:05:02.996169 2023] [wsgi:info] [pid 25977:tid
140714419545664] mod_wsgi (pid=25977): Daemon process deadlock
timer expired, stopping process 'cf-hallcam-site'.
[Mon Feb 06 21:05:02.996308 2023] [wsgi:info] [pid 25977:tid
140714434877312] mod_wsgi (pid=25977): Shutdown requested
'cf-hallcam-site'.
[Mon Feb 06 21:05:07.996544 2023] [wsgi:info] [pid 25977:tid
140714177934912] mod_wsgi (pid=25977): Aborting process
'cf-hallcam-site'.
[Mon Feb 06 21:05:07.996587 2023] [wsgi:info] [pid 25977:tid
140714177934912] mod_wsgi (pid=25977): Exiting process
'cf-hallcam-site'.
[Mon Feb 06 21:05:08.002106 2023] [wsgi:error] [pid 25848:tid
140713647920704] [client 37.81.109.237:49944] Truncated or
oversized response headers received from daemon process
'cf-hallcam-site': /home/carsten/HallCam/web/HallCam/wsgi.py
[Mon Feb 06 21:05:08.002137 2023] [wsgi:error] [pid 25848:tid
140714025395776] (104)Connection reset by peer: [client
88.75.25.178:43650] mod_wsgi (pid=25848): Failed to proxy
response from daemon., referer:
http://vdzuggmrroo5k7e9.myfritz.net:32228/
[Mon Feb 06 21:05:09.015715 2023] [wsgi:info] [pid 26028:tid
140714434877312] mod_wsgi (pid=26028): Attach interpreter ''.
[Mon Feb 06 21:05:09.027591 2023] [wsgi:info] [pid 26028:tid
140714434877312] mod_wsgi (pid=26028): Adding
'/home/carsten/HallCam/web' to path.
[Mon Feb 06 21:05:29.082057 2023] [wsgi:info] [pid 25846:tid
140714419545664] mod_wsgi (pid=25846): Daemon process deadlock
timer expired, stopping process 'cf-hallcam-site'.
[Mon Feb 06 21:05:29.082193 2023] [wsgi:info] [pid 25846:tid
140714434877312] mod_wsgi (pid=25846): Shutdown requested
'cf-hallcam-site'.
[Mon Feb 06 21:05:34.082447 2023] [wsgi:info] [pid 25846:tid
140714177934912] mod_wsgi (pid=25846): Aborting process
'cf-hallcam-site'.
[Mon Feb 06 21:05:34.082493 2023] [wsgi:info] [pid 25846:tid
140714177934912] mod_wsgi (pid=25846): Exiting process
'cf-hallcam-site'.
[Mon Feb 06 21:05:35.038614 2023] [wsgi:info] [pid 26047:tid
140714434877312] mod_wsgi (pid=26047): Attach interpreter ''.
[Mon Feb 06 21:05:35.050453 2023] [wsgi:info] [pid 26047:tid
140714434877312] mod_wsgi (pid=26047): Adding
'/home/carsten/HallCam/web' to path.
--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/deb900d2-ebf6-68a2-3ec9-c2386f5ca2d9%40cafu.de.
Hello,
hmmm. There are no .so files there:
$ pwd
/home/carsten/.virtualenvs/HallCam-web/lib/python3.10/site-packages
$ dir
insgesamt 120
drwxrwxr-x 3 carsten carsten 4096 Feb 6 20:41 asgiref
drwxrwxr-x 2 carsten carsten 4096 Feb 6 20:41
asgiref-3.6.0.dist-info
drwxrwxr-x 6 carsten carsten 4096 Feb 6 20:41 dateutil
drwxrwxr-x 3 carsten carsten 4096 Feb 6 20:40 _distutils_hack
drwxrwxr-x 18 carsten carsten 4096 Feb 6 20:41 django
drwxrwxr-x 2 carsten carsten 4096 Feb 6 20:41
Django-4.1.5.dist-info
drwxrwxr-x 2 carsten carsten 4096 Feb 6 20:41
django_improved_user-2.0a2.dist-info
drwxrwxr-x 2 carsten carsten 4096 Feb 6 20:41
django_widget_tweaks-1.4.12.dist-info
drwxrwxr-x 4 carsten carsten 4096 Feb 6 20:41 improved_user
drwxrwxr-x 5 carsten carsten 4096 Feb 6 20:40 pip
drwxrwxr-x 2 carsten carsten 4096 Feb 6 20:40
pip-22.0.2.dist-info
drwxrwxr-x 6 carsten carsten 4096 Feb 6 20:40 pkg_resources
drwxrwxr-x 2 carsten carsten 4096 Feb 6 20:41 __pycache__
drwxrwxr-x 2 carsten carsten 4096 Feb 6 20:41
python_dateutil-2.8.2.dist-info
drwxrwxr-x 7 carsten carsten 4096 Feb 6 20:40 setuptools
drwxrwxr-x 2 carsten carsten 4096 Feb 6 20:40
setuptools-59.6.0.dist-info
drwxrwxr-x 2 carsten carsten 4096 Feb 6 20:41
six-1.16.0.dist-info
drwxrwxr-x 5 carsten carsten 4096 Feb 6 20:41 sqlparse
drwxrwxr-x 2 carsten carsten 4096 Feb 6 20:41
sqlparse-0.4.3.dist-info
drwxrwxr-x 4 carsten carsten 4096 Feb 6 20:41 widget_tweaks
-rw-rw-r-- 1 carsten carsten 152 Feb 6 20:40
distutils-precedence.pth
-rw-rw-r-- 1 carsten carsten 34549 Feb 6 20:41 six.py
$ find -iname "*.so"
The last command returned no output, but I additionally looked
into the directories also in many other ways to make sure that I
didn't run a wrong search. Hmmm.
Best regards,
Carsten
--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/bb5dc1b7-b183-58d5-195d-716dd96fbedb%40cafu.de.
On 9 Feb 2023, at 7:22 am, Graham Dumpleton <Graham.D...@gmail.com> wrote:
More specifically, if you look at the stack trace you see:#6 0x00007f68aefe6292 in PyEval_RestoreThread () from target:/lib/x86_64-linux-gnu/libpython3.10.so.1.0
#7 0x00007f68af02f1dc in PyGILState_Ensure () from target:/lib/x86_64-linux-gnu/libpython3.10.so.1.0
#8 0x00007f68ac30d6e3 in ?? () from target:/usr/lib/python3.10/lib-dynload/_sqlite3.cpython-310-x86_64-linux-gnu.so
#9 0x00007f68a750b01a in sqlite3LeaveMutexAndCloseZombie () from target:/lib/x86_64-linux-gnu/libsqlite3.so.0Note how that function ends up calling PyGILState_Ensure(). That is a big no no when working with Python sub interpreters.In other words, it uses the simplified GIL state API for some callback into Python from C code of SQLite and using that when in a sub interpreter can cause deadlocks.
--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/9276e068-9ac0-5954-4170-022fc3106b9e%40cafu.de.