uvloop icon indicating copy to clipboard operation
uvloop copied to clipboard

TCP Transport RuntimeError with Python 3.13 + uvloop

Open dylangroos opened this issue 6 months ago • 4 comments

TCP Transport RuntimeError with Python 3.13 + uvloop

Summary

uvloop is causing RuntimeError: unable to perform operation on <TCPTransport closed=True> errors when used with Python 3.13. Switching to --loop asyncio fixes the issue.

Environment

  • Python: 3.13.3
  • uvloop: (latest)
  • Starlette: 0.46.2
  • FastAPI: 0.115.14

Reproduction

  1. Use Python 3.13
  2. Run uvicorn with --loop uvloop
  3. Make concurrent HTTP requests (e.g., browser loading static files)
  4. Client disconnects/refreshes during response

Workaround

Use --loop asyncio instead of uvloop.

Expected

uvloop should handle closed connections gracefully like asyncio does.

Edit

I had a stray uvicorn process that had wracked up 9hrs of CPU time, this could potentially be the issue?

dylangroos avatar Jun 27 '25 02:06 dylangroos

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 93.25%. Comparing base (2de9491) to head (1d2b6ac). :warning: Report is 209 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2325      +/-   ##
==========================================
- Coverage   93.61%   93.25%   -0.36%     
==========================================
  Files          28       35       +7     
  Lines        3760     4613     +853     
==========================================
+ Hits         3520     4302     +782     
- Misses        240      311      +71     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 27 '25 11:10 codecov[bot]

I couldn't find any testing instructions anywhere. If you got some special testing standards, feel free to tell me and I will do so :)

Also I don't know why the coverage is failing, I assumed I simply needed to increase coverage by adding a test, but the CI is still failing. :thinking:

TrimVis avatar Oct 27 '25 11:10 TrimVis

@selwin Sorry if you are not the right person to tag here.

But before I spend time on figuring out the coverage report issues, I thought it's better to ask if in principle this has a chance to be merged :)

TrimVis avatar Oct 28 '25 14:10 TrimVis

Mind adding a note of this feature in docs? https://github.com/rq/rq/blob/2a37a9f090b67b8ae3ea589b100a06fdc0439e18/docs/docs/index.md?plain=1#L436

selwin avatar Nov 08 '25 11:11 selwin

Mind adding a note of this feature in docs? https://github.com/rq/rq/blob/2a37a9f090b67b8ae3ea589b100a06fdc0439e18/docs/docs/index.md?plain=1#L436

Of course! Sorry forgot about that, I will do it once I have the time 👍

TrimVis avatar Nov 08 '25 13:11 TrimVis