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 does not check for EAGAIN and EPIPE errno #55474

Closed
socketpair mannequin opened this issue Feb 21, 2011 · 6 comments
Closed

asyncore does not check for EAGAIN and EPIPE errno #55474

socketpair mannequin opened this issue Feb 21, 2011 · 6 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@socketpair
Copy link
Mannequin

socketpair mannequin commented Feb 21, 2011

BPO 11265
Nosy @josiahcarlson, @giampaolo, @socketpair
Files
  • z.patch
  • z.patch: patch with EPIPE included
  • 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 2011-03-03.14:26:22.378>
    created_at = <Date 2011-02-21.05:18:50.977>
    labels = ['type-bug', 'library']
    title = 'asyncore does not check for EAGAIN and EPIPE errno'
    updated_at = <Date 2011-03-03.18:30:30.965>
    user = 'https://github.com/socketpair'

    bugs.python.org fields:

    activity = <Date 2011-03-03.18:30:30.965>
    actor = 'socketpair'
    assignee = 'giampaolo.rodola'
    closed = True
    closed_date = <Date 2011-03-03.14:26:22.378>
    closer = 'giampaolo.rodola'
    components = ['Library (Lib)']
    creation = <Date 2011-02-21.05:18:50.977>
    creator = 'socketpair'
    dependencies = []
    files = ['20817', '20964']
    hgrepos = []
    issue_num = 11265
    keywords = ['patch']
    message_count = 6.0
    messages = ['128939', '129810', '129822', '129835', '129969', '129991']
    nosy_count = 3.0
    nosy_names = ['josiahcarlson', 'giampaolo.rodola', 'socketpair']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue11265'
    versions = ['Python 3.1', 'Python 2.7', 'Python 3.2', 'Python 3.3']

    @socketpair
    Copy link
    Mannequin Author

    socketpair mannequin commented Feb 21, 2011

    According to man:
    ----------------------
    ERRORS
    EAGAIN or EWOULDBLOCK
    The socket is marked nonblocking and no connections are present to be accepted. POSIX.1-2001 allows either error to be returned for this case, and does not require these constants to have the same value, so a portable application should check for both possibilities.
    -----------------

    patch included

    @socketpair socketpair mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Feb 21, 2011
    @socketpair
    Copy link
    Mannequin Author

    socketpair mannequin commented Mar 1, 2011

    patch updated for handling EPIPE

    @socketpair socketpair mannequin changed the title asyncore does not check for EAGAIN errno asyncore does not check for EAGAIN and EPIPE errno Mar 1, 2011
    @giampaolo
    Copy link
    Contributor

    Ok for EAGAIN.

    I'm not completely sure about EPIPE on recv() as it is not listed here:
    http://www.kernel.org/doc/man-pages/online/pages/man2/recv.2.html
    ...although I think it's ok to treat it as an alias for connection lost anyway.

    In pyftpdlib I treat both EPIPE and EBADF as disconnect events, and this works with both select() and poll().

    Your patches should be targeted for python 3.3 (and not 2.x).

    @josiahcarlson
    Copy link
    Mannequin

    josiahcarlson mannequin commented Mar 1, 2011

    Giampaolo pinged me over email...

    These additional conditions look good, and should be targeted for 3.3 .

    Thank you :)

    @giampaolo
    Copy link
    Contributor

    Fixed in r88722.
    I did not catch EAGAIN in connect() as it makes hang some tests.

    @socketpair
    Copy link
    Mannequin Author

    socketpair mannequin commented Mar 3, 2011

    I did not catch EAGAIN in connect() as it makes hang some tests.
    maybe incorrect tests? which test(s) failed ?

    mmarkk@fad:/usr/include$ fgrep EWOULDB -r .
    ./asm-generic/errno.h:#define EWOULDBLOCK EAGAIN /* Operation would block */

    So not catching EAGAIN ( at least in Linux) can not make some tests hang.

    @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 type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant