As as a follow up to https://github.com/python/cpython/issues/118950, the fix to the issue in CPython's asyncio module seemed to translate quite well onto uvloop, and my failing tests effectively work both using the underlying socket streams and using higher level libraries such as aiohttp where the issue originally appeared.
As a quick description the issue occurs when an underlying socket is broken (typically accompanied by a BrokenPipe error), in uvloop this translates to the system.write call returning some error code which is handled in the exact same way by calling fatal_error as the sister implementation in asyncio. This implementation has a similar pitfall when the writer loop actively is ran in some kind of loop where the call_soonconnection_lost function that is supposed to mark the transport as closed (leading to an error being thrown) never is called, leading to some pretty annoying invalid state. But these details are mostly tested using asyncio but the same symptoms and underlying reasons seems to effect this implemention after some light testing, but there might be more to the story here.
These changes are effectively a port of https://github.com/python/cpython/pull/118960 with absolutely no difference except the more thorough tests reflecting the existing tests provided.
I have initially just skipped all asyncio tests as the upstream PR has yet to be merged but most likely we will see it in a future 3.12 release and newer.
Feel free to address any issues or things i've left out from here.
(It would appear the flake8 version CI/CD is using is old enough to have issues haha, locally everything is good and the error is nonsensical, do advise it and on Test_UV_FS_EVENT_RENAME failing though)
As as a follow up to https://github.com/python/cpython/issues/118950, the fix to the issue in CPython's
asyncio
module seemed to translate quite well onto uvloop, and my failing tests effectively work both using the underlying socket streams and using higher level libraries such as aiohttp where the issue originally appeared.As a quick description the issue occurs when an underlying socket is broken (typically accompanied by a BrokenPipe error), in uvloop this translates to the
system.write
call returning some error code which is handled in the exact same way by callingfatal_error
as the sister implementation in asyncio. This implementation has a similar pitfall when the writer loop actively is ran in some kind of loop where thecall_soon
connection_lost
function that is supposed to mark the transport as closed (leading to an error being thrown) never is called, leading to some pretty annoying invalid state. But these details are mostly tested using asyncio but the same symptoms and underlying reasons seems to effect this implemention after some light testing, but there might be more to the story here.These changes are effectively a port of https://github.com/python/cpython/pull/118960 with absolutely no difference except the more thorough tests reflecting the existing tests provided.
I have initially just skipped all asyncio tests as the upstream PR has yet to be merged but most likely we will see it in a future 3.12 release and newer.
Feel free to address any issues or things i've left out from here.