Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncore infinite loop on raise #53895

Closed
mmw mannequin opened this issue Aug 25, 2010 · 6 comments
Closed

asyncore infinite loop on raise #53895

mmw mannequin opened this issue Aug 25, 2010 · 6 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@mmw
Copy link
Mannequin

mmw mannequin commented Aug 25, 2010

BPO 9686
Nosy @rhettinger, @terryjreedy, @josiahcarlson, @giampaolo

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/giampaolo'
closed_at = <Date 2013-03-08.19:39:07.782>
created_at = <Date 2010-08-25.19:41:32.103>
labels = ['invalid', 'library']
title = 'asyncore infinite loop on raise'
updated_at = <Date 2013-03-08.19:39:26.785>
user = 'https://bugs.python.org/mmw'

bugs.python.org fields:

activity = <Date 2013-03-08.19:39:26.785>
actor = 'terry.reedy'
assignee = 'giampaolo.rodola'
closed = True
closed_date = <Date 2013-03-08.19:39:07.782>
closer = 'terry.reedy'
components = ['Library (Lib)']
creation = <Date 2010-08-25.19:41:32.103>
creator = 'mmw'
dependencies = []
files = []
hgrepos = []
issue_num = 9686
keywords = []
message_count = 6.0
messages = ['114931', '114933', '114940', '114953', '114964', '183759']
nosy_count = 6.0
nosy_names = ['rhettinger', 'terry.reedy', 'josiahcarlson', 'giampaolo.rodola', 'josiah.carlson', 'mmw']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue9686'
versions = ['Python 2.7']

@mmw
Copy link
Mannequin Author

mmw mannequin commented Aug 25, 2010

def send(self, data):
        try:
            result = self.socket.send(data)
            return result
        except socket.error, why:
            if why.args[0] == EWOULDBLOCK:
                return 0
            elif why.args[0] in (ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED):
                self.handle_close()
                return 0
            else:
                raise

for whatever reason the connection could break client side, if you raise an anonymous exception there it's uncatchable, raise on a socket.error or dismiss async chat is a looper.

that's the main reason why everybody gets this crazy infinite loop on for instance broken pipe error and the thing never exit, you just raise on your-self other and other again,

BTW, you could have the same issue whatever the language, this is a developer bug.

@mmw mmw mannequin added the stdlib Python modules in the Lib dir label Aug 25, 2010
@rhettinger
Copy link
Contributor

What change are you proposing?

@giampaolo
Copy link
Contributor

Could you provide a code sample which demonstrates the problem?

@mmw
Copy link
Mannequin Author

mmw mannequin commented Aug 26, 2010

First it depends on the socket type but might use a select call, secondable
raise on a socket.error, thirdable you could call the close_handle with the
message and let the guys if he would like to retry, network connection might
be capricious especially for client connected through a wifi network or
behind some firewall blocking port

the asyncchat is a looper if you don't let him catch the exception you just
create an infinite loop, this API needs a stronger model.

On Wed, Aug 25, 2010 at 3:45 PM, Giampaolo Rodola'
<report@bugs.python.org>wrote:

Giampaolo Rodola' <g.rodola@gmail.com> added the comment:

Could you provide a code sample which demonstrates the problem?

----------


Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue9686\>


@giampaolo
Copy link
Contributor

I agree with you that asyncore API model is far from being robust and I've personally seen infinite recursion more than once if certain asyncore methods aren't properly subclassed.

What I don't understand is what changes you are proposing and, again, it would be very helpful if you could provide an example code which demonstrates the problems you're complaining about (infinite recursion? broken pipe error? both?).

@terryjreedy
Copy link
Member

I am closing this because there is no identified, fixable implementation bug in any particular Python module. The fix for the asyncore *design* will be a new, re-designed module.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

3 participants