The shutdown code in ThreadedAppServer.shutDown() sends a None to all
threads to cause them to terminate, and then does a join to each thread.
The problem is that if you have a thread that is busy, perhaps a
server-push thread that is just sending a continuous stream of data, or
a thread bound up for some other reason that they will not terminate.
This causes the shutDown to lock up.
A couple of questions:
1) Should there be a timeout when shutting down, after which it just
forcibly terminates the thread, or just ignores the thread allowing the
shutDown operation to continue?
2) Should functions like flush() and write() check to see if the server
is still running, or see if the server has been trying to shutdown for
some time and then raise an error?
3) Should we just go out of the way to document the behavior in the
description of how to stop an AppServer, along with shutDown,
initiateShutDown, and probably the server-push examples?
4) Something else?
I think if we're going to leave the behavior, we should at least do
option 3 and document it. (If it's there, I must have missed it.) The
recommended usage be that any potential compute bound or long running
server-push operation should check server().running.
On another point, shouldn't server().running parameter be _running, and
use a running() function to access it?