Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

S3FileSystem.close_session raise "attached to a different loop"

オープン
#2,785 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
aws, python
領域
backend, cloud

調査の方向性

まず、FsspecFileIO の threading.local() S3FileSystem のライフサイクルと、ここで説明されている S3FileSystem.close_session の weakref クリーンアップを追跡します。Iceberg テーブルに対する同時クエリで失敗を再現し、その後、インタープリターのシャットダウン時に attached-to-a-different-loop エラーが発生しなくなったことを確認します。

索引モデルが issue の本文から書いたものです。

説明

Apache Iceberg version

main branch

Please describe the bug 🐞

Description

This error message does not appear consistently. In my case, it is reliably triggered when performing concurrent queries on an Iceberg table, but it does not occur when querying the same table with a single process or when querying other tables.

This error occurs during the execution of weakref when the Python interpreter's cleanup process is triggered.

The error message is as follows

Traceback (most recent call last):
  File "/home/*/python3.10/site-packages/aiobotocore/session.py", line 36, in __aexit__
    await self._client.__aexit__(exc_type, exc_val, exc_tb)
  File "/home/*/python3.10/site-packages/aiobotocore/client.py", line 644, in __aexit__
    await self._endpoint.http_session.__aexit__(exc_type, exc_val, exc_tb)
  File "/home/*/python3.10/site-packages/aiobotocore/httpsession.py", line 109, in __aexit__
    await self._exit_stack.aclose()
  File "/home/*/python3.10/contextlib.py", line 656, in aclose
    await self.__aexit__(None, None, None)
  File "/home/*/python3.10/contextlib.py", line 714, in __aexit__
    raise exc_details[1]
  File "/home/*/python3.10/contextlib.py", line 697, in __aexit__
    cb_suppress = await cb(*exc_details)
  File "/home/*/python3.10/site-packages/aiohttp/client.py", line 1483, in __aexit__
    await self.close()
  File "/home/*/python3.10/site-packages/aiohttp/client.py", line 1349, in close
    await self._connector.close()
  File "/home/*/python3.10/site-packages/aiohttp/connector.py", line 1044, in close
    await super().close(abort_ssl=abort_ssl or self._ssl_shutdown_timeout == 0)
RuntimeError: Task <Task pending name='Task-12' coro=<ClientCreatorContext.__aexit__() running at /home/*/python3.10/site-packages/aiobotocore/session.py:36>> got Future <Task pending name='Task-13' coro=<_wait_for_close() running at /home/*/python3.10/site-packages/aiohttp/connector.py:136>> attached to a different loop
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-12' coro=<ClientCreatorContext.__aexit__() done, defined at /home/*/python3.10/site-packages/aiobotocore/session.py:35> exception=RuntimeError("Task <Task pending name='Task-12' coro=<ClientCreatorContext.__aexit__() running at /home/*/python3.10/site-packages/aiobotocore/session.py:36>> got Future <Task pending name='Task-13' coro=<_wait_for_close() running at /home/*/python3.10/site-packages/aiohttp/connector.py:136>> attached to a different loop")>

Reason

This bug maybe be caused by #2495 . I revert #2495 and it can work normally.

In #2495 :

In FsspecFileIO, the S3FileSystem instance—which carries an event loop—is stored in threading.local(). This very likely (though I currently lack concrete evidence; it may be caused in combination with other logic) leads to the error during garbage collection at program shutdown.

Willingness to contribute
  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time
主要言語
Python
スター
1.1k
フォーク
589
平均マージ
2日 2時間
マージ済み PR(30日)
70

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/iceberg-python のほかの issue

apache/iceberg-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。