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

Handle exceptions from server callbacks #337

Merged
merged 1 commit into from
Oct 23, 2023

Commits on Oct 15, 2023

  1. Handle exceptions from server callbacks

    In its current form, when a server callback throws an exception, it is
    completely swallowed. Only when the asyncio loop is being shut down might one
    possibly see that error. On top of that, the connection is never closed, causing
    any clients to hang, and a memory leak in the server.
    
    This is a proposed fix that reports the exception to the asyncio exception
    handler. It also makes sure that the connection is always closed, even if the
    callback doesn't close it explicitly.
    
    Note that the design of AsyncIoStream is directly based on the design of
    Python's asyncio streams: https://docs.python.org/3/library/asyncio-stream.html
    These streams appear to have exactly the same flaw. I've reported this here:
    python/cpython#110894. Since I don't really know what
    I'm doing, it might be worth seeing what kind of solution they might come up
    with and model our solution after theirs.
    LasseBlaauwbroek committed Oct 15, 2023
    Configuration menu
    Copy the full SHA
    1a72d3f View commit details
    Browse the repository at this point in the history