[Mailman-Developers] Bugs in Utils.py and pythonlib/smtplib.py (Mailman 1.1)

Dan A. Dickey ddickey@wamnet.com
Tue, 09 May 2000 10:55:45 -0500


This is a multi-part message in MIME format.
--------------F3D9F94D47DB27159776C770
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Here are a couple of patches to fix file descriptor leaks
in Utils.py, and pythonlib/smtplib.py.  I looked at the new
beta of Mailman, and it didn't seem as if these bugs had been
fixed - so probably nobody has hit these but me.

The bugs are seen when sending too much to sendmail and sendmail
decides to close up shop for about 15 seconds.  Then, fds are leaked,
and eventually run_queue crashes and leaves a lock file around
(locking problem again).

I'd suggest someone work these patches into the new Mailman code;
sorry I can't do it myself.
	-Dan

-- 
Dan A. Dickey
ddickey@wamnet.com
--------------F3D9F94D47DB27159776C770
Content-Type: text/plain; charset=us-ascii;
 name="Utils-fdleak.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Utils-fdleak.patch"

*** Utils.py.orig	Thu Dec  9 08:48:41 1999
--- Utils.py	Mon Apr 24 10:31:46 2000
***************
*** 25,30 ****
--- 25,31 ----
  
  import sys
  import os
+ import time
  import string
  import re
  from UserDict import UserDict
***************
*** 333,338 ****
--- 334,341 ----
          if log_hint:
              l.write(' %s\n' % log_hint)
          l.flush()
+         l.close()
+ 	time.sleep(1.0)
  
  
  

--------------F3D9F94D47DB27159776C770
Content-Type: text/plain; charset=us-ascii;
 name="smptlib.fdleak.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="smptlib.fdleak.patch"

*** pythonlib/smtplib.py.orig	Thu Dec  9 08:48:44 1999
--- pythonlib/smtplib.py	Mon Apr 24 10:09:28 2000
***************
*** 213,219 ****
          if not port: port = SMTP_PORT
          self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          if self.debuglevel > 0: print 'connect:', (host, port)
!         self.sock.connect(host, port)
          (code,msg)=self.getreply()
          if self.debuglevel >0 : print "connect:", msg
          return (code,msg)
--- 213,224 ----
          if not port: port = SMTP_PORT
          self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          if self.debuglevel > 0: print 'connect:', (host, port)
! 	try:
!             self.sock.connect(host, port)
! 	except:
! 	    if self.debuglevel > 0: print 'connect failed, raising sock.error'
! 	    self.close()
! 	    raise socket.error, "connect failed"
          (code,msg)=self.getreply()
          if self.debuglevel >0 : print "connect:", msg
          return (code,msg)

--------------F3D9F94D47DB27159776C770--