镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Improve async robustness and cleanup #411

Open

Description

@llucax

What happened?

When we wrote this library, we didn't fully understand the details of asyncio and how to do cleanup and cancellation properly. It is not a surprise, as this can be extremely tricky and the documention for asyncio is not great at specifying this. Because of this we ended up with some code that either is not cleaning up properly, or it is hard to clean up properly.

What did you expect instead?

Things to be more robust and clean up properly.

Affected version(s)

No response

Affected part(s)

Channels, Broadcast, Anycast, etc. (part:channels), Core types (Sender, Receiver, exceptions, etc.) (part:core), Experimental features (the experimental package) (part:experimental), Utilities (Event, FileWatcher, Timer, etc.) (part:utilities), Synchronization of multiple sources (select(), merge(), etc.) (part:synchronization)

Extra information

We should fix at least these:

  • Remove all __del__ methods
  • Make all classes that need cleanup a (async) context manager
  • Make select() an async context manager (make the function use the context manager and deprecate it)
  • Research if every call to await is a checkpoint. If not, we should probably add checkpoints to all async functions

Activity

  1. added this to the Untriaged milestone on Apr 22, 2025
  2. added theissue type on Apr 22, 2025
  3. added
    part:channelsAffects channels implementation
    part:coreAffects the core types (`Sender`, `Receiver`, exceptions, etc.)
    part:synchronizationAffects the synchronization of multiple sources (`select`, `merge`)
    part:utilitiesAffects the utility receivers (`Timer`, `Event`, `FileWatcher`)
    on Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    part:channelsAffects channels implementationpart:coreAffects the core types (`Sender`, `Receiver`, exceptions, etc.)part:experimentalAffects the experimental packagepart:synchronizationAffects the synchronization of multiple sources (`select`, `merge`)part:utilitiesAffects the utility receivers (`Timer`, `Event`, `FileWatcher`)priority:highAddress this as soon as possibletype:bugSomething isn't working

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Affected Version

    None yet

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions