Skip to content

BlockingIOError and File descriptor xx is used by transport #10617

Closed
@xiaoxiper

Description

@xiaoxiper

Describe the bug

I encountered a similar issue while using the latest version of aiohttp
aiohappyeyeballs: 2.6.1

#10506 (comment)

BlockingIOError: [Errno 115] Operation now in progress

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "<inner>.py", line 135, in plan
 agent_result, _ = await asyncio.gather(
 File "<inner>.py", line 175, in a_invoke
 result = await func(parameter)
 File "<inner>.py", line 1524, in load
 result.append(await func(parameter))
 File "<inner>.py", line 129, in convert
 enum = await func(parameter)
 File "<inner>.py", line 54, in enum
 await self.enum_func(parameter)
 File "<inner>.py", line 55, in wrapper
 result = await func(*args, **kwargs)
 File "<inner>.py", line 38, in load
 async with session.post(
 File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1425, in __aenter__
 self._resp: _RetType = await self._coro
 File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 703, in _request
 conn = await self._connector.connect(
 File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 548, in connect
 proto = await self._create_connection(req, traces, timeout)
 File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1056, in _create_connection
 _, proto = await self._create_direct_connection(req, traces, timeout)
 File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1383, in _create_direct_connection
 transp, proto = await self._wrap_create_connection(
 File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1116, in _wrap_create_connection
 sock = await aiohappyeyeballs.start_connection(
 File "/usr/local/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 127, in start_connection
 raise first_exception
 File "/usr/local/lib/python3.10/site-packages/aiohappyeyeballs/_staggered.py", line 132, in run_one_coro
 result = await coro_fn()
 File "/usr/local/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 208, in _connect_sock
 await loop.sock_connect(sock, address)
 File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 499, in sock_connect
 self._sock_connect(fut, sock, address)
 File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 515, in _sock_connect
 self._ensure_fd_no_transport(fd)
 File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 248, in _ensure_fd_no_transport
 raise RuntimeError(
 RuntimeError: File descriptor 68 is used by transport <_SelectorSocketTransport fd=68 read=polling write=<idle, bufsize=0>>
'}

To Reproduce

It's difficult to reproduce directly - currently unable to reproduce with script-based stress testing; it can only be reproduced in the production environment and occurs after a period of testing

Expected behavior

Logs/tracebacks

-

Python Version

$ python --version
3.10.14

aiohttp Version

$ python -m pip show aiohttp
Name: aiohttp                                                                                                                                                                                                            
Version: 3.11.14                                                                                                                                                                                                         
Summary: Async http client/server framework (asyncio)                                                                                                                                                                    
Home-page: https://github.com/aio-libs/aiohttp                                                                                                                                                                           
Author:                                                                                                                                                                                                                  
Author-email:                                                                                                                                                                                                            
License: Apache-2.0                                                                                                                                                                                                      
Location: /usr/local/lib/python3.10/site-packages                                                                                                                                                                        
Requires: aiohappyeyeballs, aiosignal, async-timeout, attrs, frozenlist, multidict, propcache, yarl                                                                                                                      
Required-by: livekit-api

multidict Version

$ python -m pip show multidict
Name: multidict                                                                                                                                                                                                          
Version: 6.2.0                                                                                                                                                                                                           
Summary: multidict implementation                                                                                                                                                                                        
Home-page: https://github.com/aio-libs/multidict                                                                                                                                                                         
Author: Andrew Svetlov                                                                                                                                                                                                   
Author-email: [email protected]                                                                                                                                                                                   
License: Apache 2                                                                                                                                                                                                        
Location: /usr/local/lib/python3.10/site-packages                                                                                                                                                                        
Requires: typing-extensions                                                                                                                                                                                              
Required-by: aiohttp, yarl

propcache Version

$ python -m pip show propcache
Name: propcache                                                                                                                                                                                                          
Version: 0.3.0                                                                                                                                                                                                           
Summary: Accelerated property cache                                                                                                                                                                                      
Home-page: https://github.com/aio-libs/propcache                                                                                                                                                                         
Author: Andrew Svetlov                                                                                                                                                                                                   
Author-email: [email protected]                                                                                                                                                                                   
License: Apache-2.0                                                                                                                                                                                                      
Location: /usr/local/lib/python3.10/site-packages                                                                                                                                                                        
Requires:                                                                                                                                                                                                                
Required-by: aiohttp, yarl

yarl Version

$ python -m pip show yarl
Name: yarl                                                                                                                                                                                                               
Version: 1.18.3                                                                                                                                                                                                          
Summary: Yet another URL library                                                                                                                                                                                         
Home-page: https://github.com/aio-libs/yarl                                                                                                                                                                              
Author: Andrew Svetlov                                                                                                                                                                                                   
Author-email: [email protected]                                                                                                                                                                                   
License: Apache-2.0                                                                                                                                                                                                      
Location: /usr/local/lib/python3.10/site-packages                                                                                                                                                                        
Requires: idna, multidict, propcache                                                                                                                                                                                     
Required-by: aiohttp

OS

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Related component

Client

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreproducer: missingThis PR or issue lacks code, which reproduce the problem described or clearly understandable STR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions