[mod_python] Re: webinterface for a local telnet server

Steve Holden steve at holdenweb.com
Sat Oct 7 03:41:13 EDT 2006


Andreas Klauer wrote:
> On Sat, Oct 07, 2006 at 09:18:13AM +1000, Graham Dumpleton wrote:
> 
>>Before I try and address that I would ask why you are trying to perhaps
>>reinvent the wheel as others have already solved this problem.
> 
> 
> It's probably hard not to reinvent the wheel when what you want is 
> something as trivial as a telnet web application frontend, um, thingy. 
> I want it to be small, lightweight, and specifically adapted for my needs, 
> that is the sole reason why I am doing it.
> 
I think perhaps your first problem is that assumption of triviality. I 
find it's more useful to describe a problem as trivial after I have 
solved it with less than ten lines of code. Until then I'd prefer to 
describe the level of difficulty as "unknown".
> 
>>Back to your threads. The problem with using Apache/mod_python when
>>you want to preserve some state between requests is not threads but
>>processes. This is because when using prefork or worker Apache MPMs
>>on UNIX systems, subsequent requests can be directed to different Apache
>>child processes. As a result, if one child process had initiated a  
>>telnet connection, when a subsequent request arrives and it ends up being
>>processed by a different child process, it will not have access to  
>>the open connection. On Win32 boxes this isn't a problem, as there is only one
>>Apache process and all requests are handled by it.
> 
> 
> Thank you for this clarification. I could not find that information 
> anywhere although I was desparately looking for it. All I found was 
> persistence this and persistence that and I noticed that there was 
> no real persistence at all (at least the way I understand it).
> 
> Unless I missed the explanation somewhere, maybe this should go to 
> some obvious place like the FAQ?
> 
It's a fairly usual condition in web systems: the persistence referred 
to is usually persistence of session state data rather than persistence 
of process and network connection state.
> 
>>Also, even if there were some way, Apache is allowed to shutdown 
>>specific child processes at any time, so you would loose any open 
>>connection anyway.
> 
> 
> Especially this part is worth mentioning. Thanks. So there really 
> is no way but to use some daemon independent from Apache.
> 
Correct.

> Thanks for all the replies. :-)
> 
> Although that means I will need to write a daemon for almost anything 
> that needs persistence (databases don't except for performance reasons).
> 
If you want to persist a network connection across multiple web client 
interactions then you have indeed summed up your situation quite succinctly.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden



More information about the Mod_python mailing list