[Mailman-Developers] Re: [Mailman-Users] Big problems with stale lockfiles on large list...
Nigel Metheringham
Nigel.Metheringham at InTechnology.co.uk
Wed May 2 11:02:38 CEST 2001
Someone wrote (I got completely lost with the attributions in this and
can't find the original):-
> I ran into a strange little problem today -- I'm using time() to
> generate a filename for a temporary directory. Works great; until
> you start running multiple processes on a 2 CPU machine. I started
> having two processes get the same time() value (which is
> impossible on a single CPU system) and fight over the same
> directory. I'm now doing a random() based sleep to get away from
> this.
claw at kanga.nu said:
> Bad bad bad bad. You've just decreased the incidence of collisions,
> not their fact or possibility. The standard *nix approach is to use
> the process ID which is guaranteed unique. If you're not running an
> *ix, just have one process use numerically even tempfile names, and
> the other odd.
Actually you would be better advised to go the Maildir filename
approach - the filename is made up of the time(), the pid and a machine
specifier of some form. That won't have clashes unless you can wind
through your pids in under a second (although the current proposals for
random pids worries me somewhat).
Nigel.
--
[ Nigel Metheringham Nigel.Metheringham at InTechnology.co.uk ]
[ Phone: +44 1423 850000 Fax +44 1423 858866 ]
[ - Comments in this message are my own and not ITO opinion/policy - ]
More information about the Mailman-Users
mailing list