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

Don't log OSError exceptions in asyncio transports #81216

Closed
asvetlov opened this issue May 24, 2019 · 4 comments
Closed

Don't log OSError exceptions in asyncio transports #81216

asvetlov opened this issue May 24, 2019 · 4 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes topic-asyncio

Comments

@asvetlov
Copy link
Contributor

BPO 37035
Nosy @asvetlov, @1st1, @miss-islington, @Harmon758
PRs
  • bpo-37035: Don't log OSError #13548
  • [3.7] bpo-37035: Don't log OSError (GH-13548) #13594
  • 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 2019-05-27.15:52:27.734>
    created_at = <Date 2019-05-24.14:32:57.120>
    labels = ['3.7', '3.8', 'expert-asyncio']
    title = "Don't log OSError exceptions in asyncio transports"
    updated_at = <Date 2019-10-13.03:56:22.656>
    user = 'https://github.com/asvetlov'

    bugs.python.org fields:

    activity = <Date 2019-10-13.03:56:22.656>
    actor = 'Harmon758'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-27.15:52:27.734>
    closer = 'asvetlov'
    components = ['asyncio']
    creation = <Date 2019-05-24.14:32:57.120>
    creator = 'asvetlov'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37035
    keywords = ['patch']
    message_count = 4.0
    messages = ['343389', '343390', '343623', '343651']
    nosy_count = 4.0
    nosy_names = ['asvetlov', 'yselivanov', 'miss-islington', 'Harmon758']
    pr_nums = ['13548', '13594']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue37035'
    versions = ['Python 3.7', 'Python 3.8']

    @asvetlov
    Copy link
    Contributor Author

    Currently asyncio uses loop.call_exception_handler() for logging fatal exceptions from underlying sockets before calling protocol.connection_lost().

    There is a list of exceptions that are not logged: BrokenPipeError,
    ConnectionResetError, ConnectionAbortedError

    Later ssl.SSLCertVerificationError was added.

    There is a request to skip TimeoutError as well: bpo-34148

    aiohttp has a bug report about logging SSLError: aio-libs/aiohttp#3535

    I am pretty sure that the network subsystem can raise other exceptions that users don't want to see in logs.

    I suggest changing suppression logic to skip logging of *all* OSError exceptions and eliminate _FATAL_ERROR_IGNORE list.
    OSError is a sign of communication over network to peer, these problems cannot be avoided by fixing a program logic.
    All other exceptions are indicators for programming errors, the user's source code should be fixed to get rid of such problems (e.g. AttributeError raised by protocol callback etc). Logging non-OSErrors is pretty nice and desired feature.

    Note, the list now contains OSError derived exceptions only, both TimeoutError and SSLError falls into this category too.

    Not-logged exceptions are not skipped but reported to the user by protocol.connection_lost(exc) callback.
    User code can (and should) handle them properly.

    The fix is very simple, and don't change application logic.
    It can be backported to 3.7 as well.

    @asvetlov asvetlov added 3.7 (EOL) end of life 3.8 only security fixes topic-asyncio labels May 24, 2019
    @asvetlov
    Copy link
    Contributor Author

    Update.
    Currently, exceptions from the ignore list are still logged in debug mode. The proposal doesn't change this behavior.

    @miss-islington
    Copy link
    Contributor

    New changeset 1f39c28 by Miss Islington (bot) (Andrew Svetlov) in branch 'master':
    bpo-37035: Don't log OSError (GH-13548)
    1f39c28

    @asvetlov
    Copy link
    Contributor Author

    New changeset a79b6c5 by Andrew Svetlov in branch '3.7':
    [3.7] bpo-37035: Don't log OSError (GH-13548) (bpo-13594)
    a79b6c5

    @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
    3.7 (EOL) end of life 3.8 only security fixes topic-asyncio
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants