S
Stuart D. Gathman
I am doing SMTP callbacks in a Python milter
(http://pymilter.sourceforge.net) using the smtplib module. For some
spammer MXes, it takes days (!) before smtplib.sendmail will return.
Since the spammer connects to us every few seconds, this quickly leads to
a problem
I need to set a timelimit for the operation of
smtplib.sendmail. It has to be thread based, because pymilter uses
libmilter which is thread based. There are some cookbook recipies which
run a function in a new thread and call Thread.join(timeout). This
doesn't help, because although the calling thread gets a nice timeout
exception, the thread running the function continues to run. In fact, the
problem is worse, because even more threads are created.
(http://pymilter.sourceforge.net) using the smtplib module. For some
spammer MXes, it takes days (!) before smtplib.sendmail will return.
Since the spammer connects to us every few seconds, this quickly leads to
a problem
I need to set a timelimit for the operation of
smtplib.sendmail. It has to be thread based, because pymilter uses
libmilter which is thread based. There are some cookbook recipies which
run a function in a new thread and call Thread.join(timeout). This
doesn't help, because although the calling thread gets a nice timeout
exception, the thread running the function continues to run. In fact, the
problem is worse, because even more threads are created.