[Python-Dev] thread safe SMTP module
Aahz
aahz at pythoncraft.com
Wed Mar 14 19:26:20 CET 2007
On Wed, Mar 14, 2007, Jon Ribbens wrote:
> Gordon Messmer <yinyang at eburg.com> wrote:
>>
>> After some discussion, Aahz suggested that I discuss the problem here,
>> on python-dev. He seemed to think that the problem I saw may have been
>> an indication of a bug in python. Could anyone take a look at that
>> thread and say whether it looks like a bug, or working with non-blocking
>> sockets was the right thing to do?
>
> Well, not having to faff around with non-blocking IO is one of the
> major advantages of threading, so if blocking IO is indeed the cause
> of your problem then it certainly sounds like a bug in Python, or
> possibly your operating system.
One small wrinkle (and the reason I suggested bringing this to
python-dev): I suspect that the problem is not a bug, but simply the
occasional failure of sockets. When that happens in a threaded app
without timeouts, eventually threads "die" (block forever). But you
apparently can't use timeouts with file-wrapped sockets, so if that's the
problem, we need to pick one of:
* switch to non-wrapped sockets
* switch to non-blocking I/O for smtplib
* make file-wrapped sockets work with timeouts
(And please note that if my analysis is correct, we need to make the fix
for non-threaded apps, it's just more unusual to encounter the problem
there.)
This level of design decision is beyond my capabilities.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"I disrespectfully agree." --SJM
More information about the Python-Dev
mailing list