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

socket.recv() blocks while it's gettimeout() returns 0.0 #69657

Closed
animus mannequin opened this issue Oct 24, 2015 · 3 comments
Closed

socket.recv() blocks while it's gettimeout() returns 0.0 #69657

animus mannequin opened this issue Oct 24, 2015 · 3 comments

Comments

@animus
Copy link
Mannequin

animus mannequin commented Oct 24, 2015

BPO 25471
Files
  • s1.py
  • 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 = None
    closed_at = <Date 2015-10-25.03:07:43.034>
    created_at = <Date 2015-10-24.23:03:29.910>
    labels = []
    title = "socket.recv() blocks while it's gettimeout() returns 0.0"
    updated_at = <Date 2015-10-25.03:07:43.006>
    user = 'https://bugs.python.org/animus'

    bugs.python.org fields:

    activity = <Date 2015-10-25.03:07:43.006>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-10-25.03:07:43.034>
    closer = 'python-dev'
    components = []
    creation = <Date 2015-10-24.23:03:29.910>
    creator = 'animus'
    dependencies = []
    files = ['40856']
    hgrepos = []
    issue_num = 25471
    keywords = []
    message_count = 3.0
    messages = ['253418', '253419', '253420']
    nosy_count = 2.0
    nosy_names = ['python-dev', 'animus']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue25471'
    versions = ['Python 2.7', 'Python 3.5']

    @animus
    Copy link
    Mannequin Author

    animus mannequin commented Oct 24, 2015

    socket created with listening socket set to setblocking(False). gettimeout() of accept()-returned socket returns 0.0 , but recv() method blocks while client is connected and not sending any data. If client disconnects, socket returned by accept() starting return 0-length bytes string without blocking.

    glibc doc on recv():
    ---
    If nonblocking mode is set for SOCKET, and no data are available to be read, 'recv' fails immediately rather than waiting.
    ---

    testing server and client code attached.

    tested with Python 3.5.0 and Python 2.7.10

    @animus
    Copy link
    Mannequin Author

    animus mannequin commented Oct 24, 2015

    telnet 127.0.0.1 9000 can be used as testing client

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 25, 2015

    New changeset 10e044a734f3 by Benjamin Peterson in branch '3.4':
    accepted sockets shouldn't inherit the SOCK_NONBLOCK flag (closes bpo-25471)
    https://hg.python.org/cpython/rev/10e044a734f3

    New changeset 7577960ea17b by Benjamin Peterson in branch '3.5':
    merge 3.4 (bpo-25471)
    https://hg.python.org/cpython/rev/7577960ea17b

    New changeset 347221cfa224 by Benjamin Peterson in branch 'default':
    merge 3.5 (bpo-25471)
    https://hg.python.org/cpython/rev/347221cfa224

    @python-dev python-dev mannequin closed this as completed Oct 25, 2015
    @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
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants