[Mailman-Developers] lock lifetime

Harald Meland Harald.Meland@usit.uio.no
12 Apr 2000 16:53:33 +0200


--=-=-=

[bwarsaw@cnri.reston.va.us]

> Actually, I just remembered sys.exitfunc!  I can set that up to
> unlock a locked list automatically at interpreter exit.  I don't
> want it to implicitly save the list though -- you'll still have to
> do that manually if you fiddle with it from the interpreter prompt.
> 
> Note that this function doesn't run if the interpreter exits because
> of a signal or os._exit() call.

Regarding signals: Some time back, I occasionally received reports
from my users that some list, while its web admin interface was being
accessed, suddenly got unresponsive for a period of time that matched
the lock lifetime pretty well.

There were no entries/backtraces in logs/error, but I sometimes saw
list lock files left lying around, and upon checking their contents
found that their creating process was now gone.

I suspect this is what happened:

 * Web browser connects to Mailman.

 * Web browser for some reason closes its side of the connection
   before Mailman has given any response.

 * When Mailman tries to print out its response, it receives a
   SIGPIPE.

I tried fixing the problem with this patch:


--=-=-=
Content-Disposition: inline

Index: driver
===================================================================
RCS file: /projects/cvsroot/mailman/scripts/driver,v
retrieving revision 1.19
diff -u -r1.19 driver
--- driver	2000/04/06 19:30:38	1.19
+++ driver	2000/04/12 14:43:23
@@ -89,6 +89,13 @@
                 main()
             finally:
                 sys.stderr = sys.__stderr__
+        except IOError, e:
+            import errno
+            if e.errno == errno.EPIPE:
+                # Log something
+                logger.write("EPIPE caught, ARGV=%s\n" % sys.argv)
+            else:
+                raise
         except SystemExit:
             # this is a valid way for the function to exit
             pass

--=-=-=
Content-Disposition: inline

(Well, something like that patch anyway... :)

However, if my understanding of the problem is right, and this is the
correct fix for it, I don't understand why the bare except: clause
around the run_main() call in driver didn't kick in to produce a log
entry...

Does anyone have any insight on how to properly avoid SIGPIPEs in
python?
-- 
Harald

--=-=-=--