Hi <@U06RKAMK0UC> Traceback (most recent call last...
# ask-ai
a
Hi @ancient-wolf-19325 Traceback (most recent call last) ──────────────────────╮ │ /usr/lib/python3.10/weakref.py:667 in _exitfunc │ │ │ │ ❱ 667 │ │ │ │ │ │ f() │ │ │ │ /usr/lib/python3.10/weakref.py:591 in call │ │ │ │ ❱ 591 │ │ │ return info.func(*info.args, **(info.kwargs or {})) │ │ │ │ /usr/local/lib/python3.10/dist-packages/gcsfs/core.py:380 in close_session │ │ │ │ ❱ 380 │ │ │ │ asyn.sync(asyn.loop[0], session.close, timeout=0.1) │ │ │ │ /usr/local/lib/python3.10/dist-packages/fsspec/asyn.py:103 in sync │ │ │ │ ❱ 103 │ │ raise return_result │ │ │ │ /usr/local/lib/python3.10/dist-packages/fsspec/asyn.py:56 in _runner │ │ │ │ ❱ 56 │ │ result[0] = await coro │ │ │ │ /usr/lib/python3.10/asyncio/tasks.py:445 in wait_for │ │ │ │ ❱ 445 │ │ │ return fut.result() │ │ │ │ /usr/local/lib/python3.10/dist-packages/aiohttp/client.py:1327 in close │ │ │ │ ❱ 1327 │ │ │ │ await self._connector.close() │ │ │ │ /usr/local/lib/python3.10/dist-packages/aiohttp/connector.py:1044 in close │ │ │ │ ❱ 1044 │ │ await super().close(abort_ssl=abort_ssl or self._ssl_shutdown │ ╰──────────────────────────────────────────────────────────────────────────────╯ RuntimeError: Task <Task pending name='Task-19' coro=<ClientSession.close() running at /usr/local/lib/python3.10/dist-packages/aiohttp/client.py:1327> cb=[_release_waiter(<Future pendi...ask_wakeup()]>)() at /usr/lib/python3.10/asyncio/tasks.py:387]> got Future <Task pending name='Task-20' coro=<_wait_for_close() running at /usr/local/lib/python3.10/dist-packages/aiohttp/connector.py:136>> attached to a different loop
a
Reasoning Complete! 🤖 🔍 Searched knowledge base: You've shared a Python error involving aiohttp and asyncio event loops. I'll search for information on why this error occurs and how to resolve it, so I can give you the most accurate help. • Searching over 10 data sources from the following: File, Github File, Github Issue, Web • Found 61 documents that could be relevant from the following data sources: Github File, Github Issue. • Filtered down to the top 30 most relevant documents. ✍️ Generated answer: I've identified the cause of your error and a common solution. I can now provide you with clear steps to resolve the issue.
This error occurs because an asyncio task (such as closing an aiohttp ClientSession) is being awaited or finalized on a different event loop than the one it was created on. This is a common issue when using async libraries (like gcsfs or aiohttp) in environments where event loop management is handled manually or across threads, such as in Flyte tasks or plugins. To resolve this, ensure that all async operations (especially those involving aiohttp or gcsfs) are run on the same event loop. If you are using Flyte, its async utilities (like
run_sync
from
flytekit.utils.asyn
) are designed to manage event loops safely in threaded/task environments. If you are pinning versions of
fsspec
or
gcsfs
, make sure they are compatible, as mismatches can also cause async loop issues (see related issue). Would you like more detail on how to structure your code or environment to avoid this error? Sources: - Flyte Community Discussion: Pin fsspec&lt;2024.5.0 - flytekit.utils.asyn.py 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.