Checking network input processing by Python for a multi-threaded server

Markus Elfring Markus.Elfring at web.de
Sun May 19 02:37:02 EDT 2019


> socketserver threading model is that the main server loops waiting for
> connection requests, when it receives a request it creates a handler thread,

This data processing style can be generally fine as long as you would like
to work without a thread (or process) pool.


> and then it completely forgets about the thread

I have taken another look at the implementation of the corresponding methods.
https://github.com/python/cpython/blob/3.7/Lib/socketserver.py#L656

I get an other impression from the statements “self._threads.append(t)” (process_request)
and “thread.join()” (server_close).


> -- the thread is independent and completes the handling of the request.

Will a corresponding return value bet set?


> If you need to ensure everything has finished before starting the next server instance,

I am still looking for the support of software constraints in this direction.


> you will have to write the extensions to socketserver.

Will the development situation evolve any more here?

Regards,
Markus


More information about the Python-list mailing list