Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

S3FileSystem.close_session raise "attached to a different loop"

Abierto
#2,785 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
aws, python
Área
backend, cloud

Línea de trabajo

Empieza trazando el ciclo de vida de threading.local() S3FileSystem de FsspecFileIO y la limpieza mediante weakref de S3FileSystem.close_session descrita aquí. Reproduce el fallo con consultas simultáneas sobre una tabla Iceberg y verifica después que el cierre del intérprete ya no provoque el error attached-to-a-different-loop.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Python
Estrellas
1.1k
Forks
589
Merge medio
2 d 2 h
PR fusionados (30 d)
70

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/iceberg-python

Todos los issues de apache/iceberg-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.