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: File descriptor 2877 is used by transport <TCPTransport closed=False reading=True 0x55b8dc9baa90> #10362

Closed
1 task done
AntonArsentiev opened this issue Jan 27, 2025 · 7 comments
Labels

Comments

@AntonArsentiev
Copy link

AntonArsentiev commented Jan 27, 2025

Describe the bug

In our service we had aiohttp==3.8.5 and upgraded aiohttp to 3.10.5 version. That is all. In production now we have issues like issue below.
Maybe i should to write issue to another libs, tell me about it if so, or maybe you have your own fix then tell me aiohttp version i need to upgrade in my service.

To Reproduce

Unfortunetly we have it only in production mode, i do not know how reproduce it in stage mode.

Expected behavior

No issues like issue above.

Logs/tracebacks

RuntimeError: File descriptor 2877 is used by transport <TCPTransport closed=False reading=True 0x55b8dc9baa90>
  File "our_service/app/client.py", line 204, in get_recommendations
    async with self._session.get(
  File "aiohttp/client.py", line 1353, in __aenter__
    self._resp = await self._coro
  File "aiohttp/client.py", line 657, in _request
    conn = await self._connector.connect(
  File "aiohttp/connector.py", line 564, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "aiohttp/connector.py", line 975, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "aiohttp/connector.py", line 1319, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "aiohttp/connector.py", line 1073, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
  File "aiohappyeyeballs/impl.py", line 104, in start_connection
    raise first_exception
  File "aiohappyeyeballs/impl.py", line 82, in start_connection
    sock = await _connect_sock(
  File "aiohappyeyeballs/impl.py", line 174, in _connect_sock
    await loop.sock_connect(sock, address)
  File "uvloop/loop.pyx", line 2631, in sock_connect
    fut = self._sock_connect(sock, address)
  File "uvloop/loop.pyx", line 1089, in uvloop.loop.Loop._sock_connect
    self._add_writer(sock, handle)
  File "uvloop/loop.pyx", line 837, in uvloop.loop.Loop._add_writer
    self._ensure_fd_no_transport(fd)
  File "uvloop/loop.pyx", line 764, in uvloop.loop.Loop._ensure_fd_no_transport
    raise RuntimeError(

Python Version

$ python --version
Python 3.10.15

aiohttp Version

$ python -m pip show aiohttp
Name: aiohttp
Version: 3.10.5
Summary: Async http client/server framework (asyncio)

multidict Version

$ python -m pip show multidict
Name: multidict
Version: 6.1.0
Summary: multidict implementation

propcache Version

$ python -m pip show propcache
WARNING: Package(s) not found: propcache

yarl Version

$ python -m pip show yarl
Name: yarl
Version: 1.12.1
Summary: Yet another URL library

OS

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian

Related component

Server, Client

Additional context

aiohttp==3.10.5
aiohttp_traversal==0.11.0
aiojobs==1.2.0
asyncpg==0.29.0
orjson==3.9.10
uvloop==0.19.0
yarl==1.12.1

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@Dreamsorcerer
Copy link
Member

Dreamsorcerer commented Jan 27, 2025

Never seen that before. Potential compatibility issue between aiohappyeyeballs and uvloop, @bdraco?

@bdraco
Copy link
Member

bdraco commented Jan 27, 2025

Known issue with uvloop. See MagicStack/uvloop#646

@bdraco
Copy link
Member

bdraco commented Jan 27, 2025

MagicStack/uvloop#645

@bdraco
Copy link
Member

bdraco commented Jan 27, 2025

Make sure you have the latest aiohappyeyeballs as it reduces the chance the problem can happen, however ultimately it's a problem uvloop will have to fix.

@bdraco
Copy link
Member

bdraco commented Jan 27, 2025

You can also further reduce the risk of the problem happening in uvloop by disabling happyeyeballs on the connector. However that still won't solve the underlying problem in uvloop, only reduce the chance it will happen.

@AntonArsentiev
Copy link
Author

I need to set None in happy_eyeballs_delay to disable "Happy Eyeballs" right?

@bdraco
Copy link
Member

bdraco commented Jan 27, 2025

I need to set None in happy_eyeballs_delay to disable "Happy Eyeballs" right?

    happy_eyeballs_delay - This is the “Connection Attempt Delay”
                           as defined in RFC 8305. To disable
                           the happy eyeballs algorithm, set to None.

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants