Waitress is a threaded WSGI server and there isn't a safe way to kill threads inside of a process while they are blocked executing synchronous code. Even if the underlying channel is closed, the thread continues until the request is completed processing and then the response is simply discarded because the channel is gone. This is definitely a limitation of the thread-based model but in practice isn't generally a big deal. If you do need fine-grained control per-request, then a request-per-process server like gunicorn or uwsgi can help here because they can kill the process if it's taking too long to handle a request. There are pros and cons to the different approaches in terms of control, memory usage, etc.
- Michael > On May 20, 2020, at 06:29, Michal Seidl <[email protected]> wrote: > > Hello, > I can not figure out how to setup timeout (request processing takes to much > time) and limit for output data. > > I am starting server like this. > > > serve(application, > host='0.0.0.0', > port=port, > cleanup_interval=2, > channel_timeout=4 > ) > > > I am using Werkzeug Request and Response objects and jsonrpcserver dispatch > method to delegate request to my processing method. In this method I have > > time.sleep(timeToSleep) > > But even I setup timeToSleep much bigger (120s) than channel_timeout (4s) I > can seen that the request is always processed and return to client? > > > > For response size limit I can not even find suitable setting parameter. > > > > It would be nice if in both cases (timeout, maxsize reponse) server will be > able to stop/cancel/kill the corresponding process/thread/call and return > some meaningful response. > > > > Thanks for any help. > > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pylons-discuss/88812140-6abf-4403-af8c-d2639418a543%40googlegroups.com > > <https://groups.google.com/d/msgid/pylons-discuss/88812140-6abf-4403-af8c-d2639418a543%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/A37B2F04-FB0E-4713-AF3B-BC5FBB85E708%40gmail.com.
