flock experience

holger krekel pyth at devel.trillke.net
Tue Jan 14 09:21:27 CET 2003

Robin Becker wrote:
> has anybody good experience using file locking in python. I have the
> typical problem of opening a log file for a short time (cgi environment)
> in a multiprocess world. So far I think we have been lucky, but our 8
> machine front end is contracting to one machine, just for us, so the
> collision probabilities are rising. I see there's a recipe in the pcb,
> but what happens to locked out processes etc etc.

8 machines?  are you using nfs? then i don't think you should try
to do locking.  It's been a problem with smtp+mailprogramms forever
and in the end the mailbox format (each message a file) appears to be
the simplest working solution.  

Anyway, couldn't you create a file for each message/process?  another 
process could gather it so you wouldn't have to care for locking at all. 
you may need an end marker so that the gathering process doesn't
assume a message is complete too early. 



More information about the Python-list mailing list