There is a bug in asyncio's StreamReaderProtocol that can result in the garbage collector destroying tasks before they are done [1]. The affected asyncio high-level calls that we know of are: - open_connection - start_server - open_unix_connection - start_unix_server Today, we only use 'open_connection' and 'open_unix_connection' in portopencheck, but we do not wait for any data from those connections. To trigger the bug, the garbage collector must run when we wait for new data by, for example 'await streamreader.read()'. This bug shouldn't affect us right now, but we need to be careful when writing new code if the bug isn't fixed upstream. [1] https://github.com/python/cpython/issues/91887
Note that this doesn't affect asyncio.create_subprocess_exec() even though it uses the stream API. The reason is that the bug is in StreamReaderProtocol, not StreamRead, and asyncio.create_subprocess_exec() uses its own protocol class.