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

RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x55dc68caf9f0>; the handl... #4901

Open
sentry-io bot opened this issue Sep 9, 2024 · 1 comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix help wanted Open to participation from the community 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: api Related to the Django API 🔧 tech: django Involves Django

Comments

@sentry-io
Copy link

sentry-io bot commented Sep 9, 2024

Sentry Issue: OPENVERSE-API-YE

RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x55dc68caf9f0>; the handler is closed
  File "uvloop/sslproto.pyx", line 714, in uvloop.loop.SSLProtocol._do_read
  File "uvloop/sslproto.pyx", line 699, in uvloop.loop.SSLProtocol._process_outgoing
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
    self._ensure_alive()
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
    raise RuntimeError(

Fatal error on SSL protocol
protocol: <uvloop.loop.SSLProtocol object at 0x7fbb6a8681a0>
transport: <TCPTransport closed=True reading=False 0x55dc68caf9f0>
@sentry-io sentry-io bot added help wanted Open to participation from the community 💻 aspect: code Concerns the software code in the repository 🔧 tech: django Involves Django 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: api Related to the Django API labels Sep 9, 2024
@sarayourfriend
Copy link
Contributor

I thought this would be fixed in #4875, but they are still happening.

This error is worrisome because there is very little visibility into what the effect of it is, and it's been difficult to understand exactly where it comes from, what causes it, or even when it happens.

My suggested plan of action to try to address this is, unfortunately, purely speculative. It is as follows:

  • Upgrade aiohttp to make sure this isn't a bug fix with uvloop compatibility
    • I somewhat doubt this will fix it, but it's the easiest first-thing to try
  • Find out if there is a way to check for closed TCPTransports in get_aiohttp_session, if for some reason checking that the session is closed isn't doing the trick
    • I've looked through aiohttp's code a lot, and I've convinced myself this isn't possible... but I was looking at the version of aiohttp we currently use, and there are aiohttp changelog references to transport improvements, so things might be different after we upgrade aiohttp.
    • If we can't directly check if the TCPTransport is closed, maybe there are some aiohttp tracing hooks where we could do that, and through that potentially find out at least the context this happens in...
  • Upgrade to Django 5.1 so we can take advantage of the cancelled request (on the client side) handling, which may be causing some other cleanup issues
  • Try switching to HTTPx instead of aiohttp (pook supports both now, so it should be possible); there are indications in the GitHub issues for uvloop, uvicorn, httpx, aiohttp, and asgiref that aiohttp may have issues with uvloop, even if not fixed in upgrading
  • Try running uvicorn with non-uvloop and see if it goes away (which would indicate a uvloop-related issue rather than something else we've done wrong or some other library)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix help wanted Open to participation from the community 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: api Related to the Django API 🔧 tech: django Involves Django
Projects
Status: 📅 To Do
Development

No branches or pull requests

1 participant