RuntimeError: unable to perform operation on <TCPTransport
See original GitHub issueChecklist
- The bug is reproducible against the latest release and/or
master
. - [?] There are no similar issues or pull requests to fix it yet.
Describe the bug
We are seeing frequent RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x7f25014d3810>; the handler is closed
To reproduce
Run django with latest uvicorn inside kubernetes.
Expected behavior
No error
Actual behavior
Error
Debugging material
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x55abf67bcd50>; the handler is closed
File "websockets/legacy/server.py", line 232, in handler
await self.close()
File "websockets/legacy/protocol.py", line 779, in close
await asyncio.shield(self.close_connection_task)
File "websockets/legacy/protocol.py", line 1309, in close_connection
self.transport.write_eof()
File "uvloop/handles/stream.pyx", line 696, in uvloop.loop.UVStream.write_eof
File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
Environment
- OS / Python / Uvicorn version: ubuntu / python 3.7 / uvicorn[standard]==0.15.0
- The exact command you’re running uvicorn with, all flags you passed included. If you run it with gunicorn please do the same. If there is a reverse-proxy involved and you cannot reproduce without it please give the minimal config of it to reproduce.
Additional context
This started happening when we started using uvicorn. In production it happens quite often:
There are some similar issues:
- https://github.com/encode/uvicorn/pull/1140 - this is a issue with websockets on graceful shutdown. Considering the amount of exceptions, it seems like this is happening frequently, not just on shutdown
- https://github.com/encode/uvicorn/issues/1229 - Someone ran into the same problem but decided to close it as an issue with websockets library. Given that the issue started occurring when we used uvicorn, I suspect an issue with uvicorn.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:33 (5 by maintainers)
Top Results From Across the Web
RuntimeError: unable to perform operation on TCPTransport ...
I think it happens because of your database connection is closed by the server or a TCP timeout while it's in the pool....
Read more >Log error TCPTransport - Home Assistant OS
Here is the error I see in my Hassio log. I have no clue what to do to fix it. Can you help...
Read more >unable to perform operation on <TCPTransport closed=True ...
hi,i use python3.5.3 aiohttp 2.0.7 aiomysql 0.0.9 sqlalchemy1.1.10. When i open the application for a long time.Throw the following error.
Read more >fail to upload esphome : r/homeassistant - Reddit
_ensure_alive RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x55de4b9067c0>; the handler is closed.
Read more >Unable to perform operation. An unexpected error (0x65b) has ...
LIKE | COMMENT | SHARE | SUBSCRIBE#0x65b..............powercfg /h off error fixing like that Unable to perform ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Downgrading to websockets==10.1 resolved the issue for me.
lots of info here, a minimal reproducible example would tremendously help, I’m not able to reproduce