mod_wsgi
mod_wsgi copied to clipboard
How to add request-timeout?
https://modwsgi.readthedocs.io/en/master/configuration-directives/WSGIDaemonProcess.html
How can I set request-timeout when I use your mod_wsgi package. Is it possible to pass request-timeout just after runmodwsgi command?
Run it with the --help option and you will see all the options you can pass, including --request-timeout.
Also watch:
- https://www.youtube.com/watch?v=CPz0s1CQsTE
Thanks a lot. I'm getting this error during large file upload:
[Thu Sep 16 12:09:16.214778 2021] [wsgi:info] [pid 336:tid 140316382443264] mod_wsgi (pid=336): Daemon process request time limit exceeded, stopping process 'localhost:8080'. [Sat Sep 18 23:56:44.656095 2021] [wsgi:info] [pid 275:tid 139744106407808] mod_wsgi (pid=275): Shutdown requested 'localhost:8080'.
Then my process is restrating then am getting this error: [Thu Sep 16 12:21:57.519115 2021] [wsgi:error] [pid 274:tid 140316656023296] [client 192.168.1.144:57644] mod_wsgi (pid=274): Request data write error when proxying data to daemon process: Broken pipe., referer: http://192.168.1.83:7080/
Setting request-timeout can be a solution?
Maybe. As noted in that video the default request timeout is 60 seconds, although it isn't as simple as that when using multithreaded daemon process.
Be aware that unless you specifically have long running requests, triggering that can be an indicator of a bug in your application as it indicates requests are hanging or blocking indefinitely on backend services. So you shouldn't just increase the timeout, you should work out whether your application is getting stuck.
How long do you expect requests to run for?
As to the last error, unless you only showed select log messages, it doesn't correspond to the timeout message above, so hard to say for sure whether they are related.
Also, your log messages don't seem to show mod_wsgi trying to log the stack traces for where request handlers were when it force a restart of the process, which would help you work out whether you do have a bug in your application.
Is this all the log messages there were?
2021-09-18 22:10:55,613 DEBG 'runserver' stderr output:
[Sat Sep 18 22:10:55.613431 2021] [wsgi:info] [pid 373:tid 140316382443264] mod_wsgi (pid=373): Daemon process request time limit exceeded, stopping process 'localhost:8080'.
2021-09-18 22:10:55,679 DEBG 'runserver' stderr output:
[Sat Sep 18 22:10:55.636932 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): Shutdown requested 'localhost:8080'.
2021-09-18 22:10:55,679 DEBG 'runserver' stderr output:
[Sat Sep 18 22:10:55.679214 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): Dumping stack trace for active Python threads.
[Sat Sep 18 22:10:55.679221 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): Thread 140315203786496 executing file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/wsgi.py", line 30, in _read_limited
[Sat Sep 18 22:10:55.679225 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/wsgi.py", line 42, in read,
[Sat Sep 18 22:10:55.679237 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/http/request.py", line 344, in read,
[Sat Sep 18 22:10:55.679240 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/http/multipartparser.py", line 436, in __next__,
[Sat Sep 18 22:10:55.679242 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/http/multipartparser.py", line 373, in __next__,
[Sat Sep 18 22:10:55.679244 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/http/multipartparser.py", line 505, in __next__,
[Sat Sep 18 22:10:55.679247 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/http/multipartparser.py", line 373, in __next__,
[Sat Sep 18 22:10:55.679249 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/http/multipartparser.py", line 232, in parse,
[Sat Sep 18 22:10:55.679252 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/rest_framework/parsers.py", line 113, in parse,
[Sat Sep 18 22:10:55.679255 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/rest_framework/request.py", line 350, in _parse,
[Sat Sep 18 22:10:55.679258 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/rest_framework/request.py", line 275, in _load_data_and_files,
[Sat Sep 18 22:10:55.679261 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/rest_framework/request.py", line 212, in data,
[Sat Sep 18 22:10:55.679264 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/home/django/cvat/apps/engine/views.py", line 1461, in data,
[Sat Sep 18 22:10:55.679266 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py", line 492, in dispatch,
[Sat Sep 18 22:10:55.679269 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/rest_framework/viewsets.py", line 116, in view,
[Sat Sep 18 22:10:55.679272 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/views/decorators/csrf.py", line 54, in wrapped_view,
[Sat Sep 18 22:10:55.679275 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 113, in _get_response,
[Sat Sep 18 22:10:55.679278 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner,
[Sat Sep 18 22:10:55.679281 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django_currentuser/middleware.py", line 34, in __call__,
[Sat Sep 18 22:10:55.679283 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner,
[Sat Sep 18 22:10:55.679286 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/utils/deprecation.py", line 94, in __call__,
[Sat Sep 18 22:10:55.679288 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner,
[Sat Sep 18 22:10:55.679290 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/utils/deprecation.py", line 94, in __call__,
[Sat Sep 18 22:10:55.679292 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner,
[Sat Sep 18 22:10:55.679294 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/utils/deprecation.py", line 94, in __call__,
[Sat Sep 18 22:10:55.679298 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner,
[Sat Sep 18 22:10:55.679299 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/utils/deprecation.py", line 94, in __call__,
[Sat Sep 18 22:10:55.679301 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner,
[Sat Sep 18 22:10:55.679302 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/utils/deprecation.py", line 94, in __call__,
[Sat Sep 18 22:10:55.679304 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner,
[Sat Sep 18 22:10:55.679305 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/utils/deprecation.py", line 94, in __call__,
[Sat Sep 18 22:10:55.679307 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner,
[Sat Sep 18 22:10:55.679308 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/utils/deprecation.py", line 94, in __call__,
[Sat Sep 18 22:10:55.679310 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner,
[Sat Sep 18 22:10:55.679311 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/utils/deprecation.py", line 94, in __call__,
[Sat Sep 18 22:10:55.679313 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner,
[Sat Sep 18 22:10:55.679314 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/utils/deprecation.py", line 94, in __call__,
[Sat Sep 18 22:10:55.679316 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 34, in inner,
[Sat Sep 18 22:10:55.679317 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 75, in get_response,
[Sat Sep 18 22:10:55.679319 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/django/core/handlers/wsgi.py", line 141, in __call__,
[Sat Sep 18 22:10:55.679321 2021] [wsgi:info] [pid 373:tid 140316736169856] mod_wsgi (pid=373): called from file "/usr/local/lib/python3.5/dist-packages/mod_wsgi/server/__init__.py", line 1501, in handle_request.
2021-09-18 22:11:00,679 DEBG 'runserver' stderr output:
[Sat Sep 18 22:11:00.679198 2021] [wsgi:info] [pid 373:tid 140314962003712] mod_wsgi (pid=373): Aborting process 'localhost:8080'.
[Sat Sep 18 22:11:00.679224 2021] [wsgi:info] [pid 373:tid 140314962003712] mod_wsgi (pid=373): Exiting process 'localhost:8080'.
2021-09-18 22:11:08,168 DEBG 'runserver' stderr output:
[Sat Sep 18 22:11:08.168768 2021] [wsgi:error] [pid 310:tid 140316735166208] [client 192.168.1.144:41058] mod_wsgi (pid=310): Request data write error when proxying data to daemon process: Broken pipe., referer: http://192.168.1.83:7080/
2021-09-18 22:11:08,739 DEBG 'runserver' stderr output:
[Sat Sep 18 22:11:08.739447 2021] [wsgi:info] [pid 11:tid 140316736169856] mod_wsgi (pid=373): Process 'localhost:8080' has died, deregister and restart it.
[Sat Sep 18 22:11:08.739534 2021] [wsgi:info] [pid 11:tid 140316736169856] mod_wsgi (pid=373): Process 'localhost:8080' has been deregistered and will no longer be monitored.
2021-09-18 22:11:08,739 DEBG 'runserver' stderr output:
[Sat Sep 18 22:11:08.739789 2021] [wsgi:info] [pid 425:tid 140316736169856] mod_wsgi (pid=425): Starting process 'localhost:8080' with threads=5.
2021-09-18 22:11:09,766 DEBG 'runserver' stderr output:
[Sat Sep 18 22:11:09.765930 2021] [wsgi:info] [pid 425:tid 140316736169856] mod_wsgi (pid=425): Python home /usr.
2021-09-18 22:11:10,094 DEBG 'runserver' stderr output:
[Sat Sep 18 22:11:10.093520 2021] [wsgi:info] [pid 425:tid 140316736169856] mod_wsgi (pid=425): Initializing Python.
2021-09-18 22:11:17,495 DEBG 'runserver' stderr output:
[Sat Sep 18 22:11:17.495375 2021] [wsgi:info] [pid 425:tid 140316736169856] mod_wsgi (pid=425): Attach interpreter ''.
2021-09-18 22:11:17,999 DEBG 'runserver' stderr output:
[Sat Sep 18 22:11:17.999719 2021] [wsgi:info] [pid 425:tid 140316736169856] mod_wsgi (pid=425): Imported 'mod_wsgi'.
2021-09-18 22:11:18,084 DEBG 'runserver' stderr output:
[Sat Sep 18 22:11:18.084828 2021] [wsgi:info] [pid 425:tid 140316736169856] mod_wsgi (pid=425, process='localhost:8080', application=''): Loading Python script file '/tmp/cvat-server/handler.wsgi'.
2021-09-18 22:11:53,946 DEBG 'ssh-agent' stderr output:
debug2: fd 4 setting O_NONBLOCK
debug1: type 17
2021-09-18 22:11:53,947 DEBG 'ssh-agent' stderr output:
debug1: XXX shrink: 3 < 4
debug2: fd 4 setting O_NONBLOCK
debug1: type 11
debug1: XXX shrink: 3 < 4
2021-09-18 22:20:24,845 DEBG 'runserver' stderr output:
[Sat Sep 18 22:20:24.845647 2021] [wsgi:error] [pid 310:tid 140316735166208] [client 192.168.1.144:41058] mod_wsgi (pid=310): Request data write error when proxying data to daemon process: Broken pipe., referer: http://192.168.1.83:7080/
[Sat Sep 18 22:20:24.845692 2021] [wsgi:error] [pid 310:tid 140316735166208] [client 192.168.1.144:41058] Truncated or oversized response headers received from daemon process 'localhost:8080': /tmp/cvat-server/htdocs/api, referer: http://192.168.1.83:7080/
Here my all log messages. App is based on opencv cvat computer vision annotation tool. Trying to fix this problem. And again thank you very much I will consider your each sentence
The stack trace to me suggests that the application is blocking on reading request content from the client. This could be because the client has not sent as much data as it claimed it would and so application is blocking waiting for more, or you are dealing with a mobile client and a network error has occurred resulting in request connection with the client hanging and not all data being sent through.
I will check these all. Thank you