Bug? asyncore.dispatcher_with_send trouble

Freddie lion-freddie at zebra-madcowdisease.giraffe-org
Wed Jul 7 19:38:32 EDT 2004


Steve Holden wrote:
> Freddie wrote:
> 
>> Hi,
>>
>> I've been mangling python-irclib into an asyncore class, so it fits in 
>> nicely with the rest of my app. I ran into a problem with 
>> asyncore.dispatcher_with_send (Python 2.3.4), though. Not sure if this 
>> is the right place to file a bug, but here goes:
>>
> No, it isn't. The right place to file a bug would be
> 
>     http://sourceforge.net/tracker/?group_id=5470&atid=105470

Ah. Thanks.

<snip>

> 
> I haven't actually studied your code in detail, but I have trouble 
> understanding how something so apparently reliable as asyncore is 
> suddenly revealed to have fatal flaws in it. Sam Rushing is a pretty 
> experienced programmer.
> 
> Under what circumstances does calling .send(data) result in exceptions 
> being raised?
> 
> regards
>  Steve

I'm actually being slightly crazy and using a single dispatcher for the 
entire 'life' of that IRC connection. It can be connected/disconnected 
multiple times over it's life. Calling send() can sometimes happen when 
the socket is closed/broken/whatever, so calling initiate_send() 
straight away in there can and will blow up... and it's outside the 
normal handle_error() exception trap (read/write methods in 
asyncore.py). This is not how I thought a 'buffered output' dispatcher 
would work. Having a 'buffered' send() that can actually block, or even 
raise an exception that you have to catch yourself (instead of 
handle_error being called like every other exception) seems broken to me :|

Freddie



More information about the Python-list mailing list