SocketServer - multithreading

Jeremy Jones Jeremy.Jones at peregrine.com
Thu Oct 11 12:04:48 EDT 2001


On Thu, Oct 11, 2001 at 11:38:45AM -0400, Oleg Broytmann wrote:


>Wow! The code looks VERY familiar to me! :)))

Actually, I think that you are the one I "borrowed" it from.  Good piece of
code.  That's why I used it.

>   Do you run the program in the background? It is possible that the
>program stuck upon printing the request, because background programs
>usually disallowed to write to console. Upon printing the program receives
>SIGTSTOP signal and stops.
>   Do not write to stdout from a background process.

I am running it in the foreground unless the SocketServer module pushes it
to the background somewhere (which I can't see that it does by looking
through the module).  I start it like this:
[jjones at mahler get_request]$ ./pyserver.py 
Waiting...

And there is one instance of it running:
[jjones at mahler socket]$ ps -ef | grep server
jjones   12790 12570  0 12:16 pts/19   00:00:00 python -O ./pyserver.py
jjones   12796 12610  0 12:17 pts/21   00:00:00 grep server
[jjones at mahler socket]$ 

But when I hit it with the first client, I guess it spawns a child process:
[jjones at mahler socket]$ ps -ef | grep server
jjones   12790 12570  0 12:16 pts/19   00:00:00 python -O ./pyserver.py
jjones   12800 12790  0 12:18 pts/19   00:00:00 python -O ./pyserver.py
jjones   12805 12610  0 12:18 pts/21   00:00:00 grep server
[jjones at mahler socket]$ 

Anyway, I'm not running in the background.....


Jeremy





More information about the Python-list mailing list