SMTPDirect doesn't use persistent SMTP connections
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Mailman |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Mailman 2.1.1 here.
"/Mailman/
SMTP connections up to
"mm_cfg.
messages.
Nevertheless, it's NOT the case: "SMTPDirect" drop the
connection when send each message. This is an important
CPU hog when mailman has a long queue spool.
Here is the patch (sorry, I can't send it as an attach,
shame on me). It's fairly trivial :
>>>>>
Index: SMTPDirect.py
=======
RCS file:
/opt/src/
retrieving revision 1.1.1.5
retrieving revision 1.1.1.5.2.1
diff -u -u -r1.1.1.5 -r1.1.1.5.2.1
--- SMTPDirect.py 2003/03/20 10:14:58 1.1.1.5
+++ SMTPDirect.py 2003/03/21 16:48:31 1.1.1.5.2.1
@@ -48,7 +48,7 @@
# Manage a connection to the SMTP server
-class Connection:
+class ConnectionClass:
def __init__(self):
@@ -79,7 +79,15 @@
def quit(self):
+ def rset(self) :
+ self.__conn.rset()
+ def __del__(self) :
+ self.quit()
+
+
+Connection=
+
def process(mlist, msg, msgdata):
recips = msgdata.
@@ -130,7 +138,7 @@
# This means at worst, the last chunk for which
delivery was attempted
# could get duplicates but not every one, and no
recips should miss the
# message.
- conn = Connection()
+ conn = Connection
try:
while chunks:
@@ -147,7 +155,8 @@
del msgdata[
finally:
- conn.quit()
+ conn.rset()
+ # conn.quit()
# Log the successful post
t1 = time.time()
<<<<<
Logged In: YES
user_id=97460
The proposed patch causes exceptions if space between
messages is greater than SMTP timeout.
Corrected patch (I still can't attach a file):
>>>>>
Index: SMTPDirect.py ======= ======= ======= ======= ======= ======= ======= ======= ==== cvsroot/ mailman/ Mailman/ Handlers/ SMTPDirect. py,v
=======
RCS file:
/opt/src/
retrieving revision 1.1.1.5
retrieving revision 1.1.1.5.2.3
diff -u -r1.1.1.5 -r1.1.1.5.2.3
--- SMTPDirect.py 2003/03/20 10:14:58 1.1.1.5
+++ SMTPDirect.py 2003/03/24 07:11:32 1.1.1.5.2.3
@@ -48,7 +48,7 @@
# Manage a connection to the SMTP server
self. __connect( )
-class Connection:
+class ConnectionClass:
def __init__(self):
@@ -58,6 +58,15 @@
self. __numsessions = SMTP_MAX_ SESSIONS_ PER_CONNECTION
mm_cfg.
def sendmail(self, envsender, recips, msgtext):
results = self.__ conn.sendmail( envsender, SMTPException:
self. __conn. quit()
+ try :
+ self.__conn.rset()
+ except :
+ try :
+ self.__conn.quit()
+ except :
+ pass
+ self.__connect()
+
try:
recips, msgtext)
except smtplib.
@@ -79,6 +88,11 @@
def quit(self):
+ def __del__(self) : ConnectionClass ()
+ self.quit()
+
+
+Connection=
def process(mlist, msg, msgdata):
msgdata[ 'undelivered' ] = chunks
raise 'undelivered' ]
msgdata[ 'recips' ] = origrecips
@@ -130,7 +144,7 @@
# This means at worst, the last chunk for which
delivery was attempted
# could get duplicates but not every one, and no recips
should miss the
# message.
- conn = Connection()
+ conn = Connection
try:
while chunks:
@@ -147,7 +161,7 @@
del msgdata[
finally:
- conn.quit()
+ # conn.quit()
# Log the successful post
t1 = time.time()
<<<<<