Checking network input processing by Python for a multi-threaded server
Markus.Elfring at web.de
Sun May 19 13:26:51 EDT 2019
>> I get an other impression from the statements “self._threads.append(t)” (process_request)
>> and “thread.join()” (server_close).
> Okay -- v3.7 has added more logic that didn't exist in the v3.5 code
> I was examining... (block_on_close is new).
Thanks for such a version comparison.
> However, I need to point out that this logic is part of server_close(),
> which is not the same as shutdown(). You have been calling shutdown() which
> only ends the loop accepting new connections, but leaves any in-process
> threads to finish handling their requests.
> server_close() needs to be called by your code, I would expect AFTER
> calling shutdown() to stop accepting new requests (and starting new threads
> which may not be in the list that the close is trying to join).
Should this aspect be taken into account by the code specification “with server:”?
> And after calling server_close() you will not be able to simply "restart" the server
> -- you must go through the entire server initialization process
> (ie: create a whole new server instance).
This should be finally achieved by the implementation of my method “perform_command”.
I hope that corresponding data processing can be cleanly repeated then
as desired for test purposes.
More information about the Python-list