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

asyncio DatagramProtocol stops calling callbacks after OSError, on Windows #88906

Closed
JulianOrteil mannequin opened this issue Jul 26, 2021 · 4 comments
Closed

asyncio DatagramProtocol stops calling callbacks after OSError, on Windows #88906

JulianOrteil mannequin opened this issue Jul 26, 2021 · 4 comments
Labels
OS-windows topic-asyncio type-bug An unexpected behavior, bug, or error

Comments

@JulianOrteil
Copy link
Mannequin

JulianOrteil mannequin commented Jul 26, 2021

BPO 44743
Nosy @asvetlov, @1st1, @sim1234, @JulianOrteil
Files
  • reproducible_datagramprotocol_error.py: Reproducible code
  • 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 = None
    created_at = <Date 2021-07-26.14:50:58.620>
    labels = ['type-bug', '3.9', 'expert-asyncio']
    title = 'asyncio DatagramProtocol stops calling callbacks after OSError'
    updated_at = <Date 2021-11-14.20:12:24.291>
    user = 'https://github.com/JulianOrteil'

    bugs.python.org fields:

    activity = <Date 2021-11-14.20:12:24.291>
    actor = 'sim1234'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['asyncio']
    creation = <Date 2021-07-26.14:50:58.620>
    creator = 'JulianOrteil'
    dependencies = []
    files = ['50183']
    hgrepos = []
    issue_num = 44743
    keywords = []
    message_count = 2.0
    messages = ['398229', '406332']
    nosy_count = 5.0
    nosy_names = ['asvetlov', 'yselivanov', 'sim1234', 'Thomas Trummer', 'JulianOrteil']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue44743'
    versions = ['Python 3.9']

    @JulianOrteil
    Copy link
    Mannequin Author

    JulianOrteil mannequin commented Jul 26, 2021

    After working through the Transports and Protocols documentation of asyncio, I decided to stress test the DatagramProtocol as an application I'm developing needs to act as a UDP server.

    One of my tests drops the client before the server responds which raises an OSError on the server; however, after the error is raised, the server stops executing callbacks (like connection_made, datagram_received, error_received and connection_lost) until it is restarted. There is no documentation I can find that explains this behavior nor is there any meaningful discussions about it elsewhere. I don't think the socket itself drops because the client doesn't raise an OSError itself when connecting to the now-errored server.

    Interestingly though, when I tried to enable debug mode of the loops on both the client to see if there were any silent errors being raised (which didn't occur), this issue doesn't occur. Enabling debug mode on the server had no effect.

    Attached is the reproducible code; it is a slightly modified version of the UDP Echo Client/Server example found in the docs named above. My environment is Python 3.9.5 on Windows 10.

    @JulianOrteil JulianOrteil mannequin added 3.9 only security fixes topic-asyncio type-bug An unexpected behavior, bug, or error labels Jul 26, 2021
    @sim1234
    Copy link
    Mannequin

    sim1234 mannequin commented Nov 14, 2021

    I'm experiencing the same exact issue. The bug manifests with all combinations: SelectorEventLoop and ProactorEventLoop, python 3.9 and 3.10, on Windows 10. Python 3.8 on Linux seems to not be affected. Can we get a fix or at least an update?

    @AdjWang
    Copy link

    AdjWang commented Jun 25, 2022

    Same issue using python 3.10 on windows 10. The issue can also happen on the client-side.
    During the client and server exchanging messages, I restarted the server process. The client raised "OSError: [WinError 1234] No service is operating at the destination network endpoint on the remote system", then it stopped receiving messages even after the server process restarted.
    However the sending on the client-side is still working since the restarted server can receive messages from the client.

    @gvanrossum gvanrossum changed the title asyncio DatagramProtocol stops calling callbacks after OSError asyncio DatagramProtocol stops calling callbacks after OSError, on Windows Aug 25, 2022
    @kumaraditya303 kumaraditya303 removed the 3.9 only security fixes label Oct 28, 2022
    @kumaraditya303
    Copy link
    Contributor

    Duplicate of #91227

    @kumaraditya303 kumaraditya303 marked this as a duplicate of #91227 Nov 1, 2024
    @kumaraditya303 kumaraditya303 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows topic-asyncio type-bug An unexpected behavior, bug, or error
    Projects
    Status: Done
    Development

    No branches or pull requests

    3 participants