[Mailman-Developers] Re: [Mailman-Users] Big problems with stale lockfiles on large list...

Barry A. Warsaw barry@digicool.com
Thu, 3 May 2001 15:26:38 -0400

>>>>> "BAW" == Barry A Warsaw <barry@digicool.com> writes:

    BAW> So the code in admin.py looks something like:

    | def main():
    |     ...
    |     mlist = MailList.MailList(listname, lock=0)
    |     ...
    |     def sigterm_handler(signum, frame, mlist=mlist):
    |         mlist.Unlock()
    |     mlist.Lock()
    |     try:
    |         signal.signal(signal.SIGTERM, sigterm_handler)
    |         ...
    |         mlist.Save()
    |     finally:
    |         mlist.Unlock()

I think this code isn't quite right.  I think to be totally safe, you
want sigterm_handler() to sys.exit(0) after the call to
mlist.Unlock().  Otherwise, depending on race conditions, after
unlocking the list you could still enter Save(), which would fail
because it would first try to refresh a lock you no longer own.

I'll work up a proper patch to Mailman 2.0.4 and post it to SF for you
to try.  Or you could modify your patched version and test it in the