[issue1161031] Neverending warnings from asyncore

Josiah Carlson report at bugs.python.org
Tue Mar 31 18:30:33 CEST 2009


Josiah Carlson <josiahcarlson at users.sourceforge.net> added the comment:

Your analysis WRT handle_expt_event() is correct.  I've been meaning to 
fix that for a while, but I forgot to do it in 2.6/3.0 with all of the 
other changes/fixes.  Looking at the docs, you are also right about 
POLLNVAL.

I also don't *know* what to do when presented with POLLERR, but few 
socket errors are transient (transient errors should be handled by the 
underlying stacks), so I agree with you that they should just be closed.

I went ahead and made the changes as you have suggested, and also made 
the same change with the select-based loop.  Errors on the socket just 
result in closing the socket, resulting in _exception() -> close().

Thinking about it, I've also had a change of heart, and added a 
frozenset object called 'ignore_log_types', which specifies the log 
types to ignore.  By default it is populated with 'warning', which 
squelches all currently existing "unhandled * event" bits.  If you use 
self.log(arg) or self.log_info(one_arg), those lines are unchanged.  
Handle_error() uses the "error" type, which is also nice, but which you 
can also suppress with ease (though you really should be logging them so 
you can fix your code).

I've attached a version that I think is pretty reasonable.  Comments?  
Questions?

----------
keywords: +needs review, patch
versions: +Python 2.7 -Python 2.6
Added file: http://bugs.python.org/file13516/async_no_warn.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1161031>
_______________________________________


More information about the Python-bugs-list mailing list