`serve()` fails on Python 3.14: `asyncio.get_event_loop()` raises instead of creating a loop
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 58/100
Línea de trabajo
Comienza en crossplane/function/runtime.py alrededor de la línea 98 y sigue serve() a través de la configuración del manejador de señales y la llamada a run_until_complete. Compara el rango de Python declarado en pyproject.toml con la cobertura de una única versión en .github/workflows/ci.yml y luego reproduce el fallo usando function-template-python con python:3.14-slim. Se considera terminado cuando el punto de entrada se inicia y atiende solicitudes en Python 3.14 sin romper la suite existente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happened?
crossplane.function.runtime.serve() calls asyncio.get_event_loop() from a
synchronous context:
https://github.com/crossplane/function-sdk-python/blob/main/crossplane/function/runtime.py#L98
On Python 3.14 that raises instead of creating a loop, so any function built on
the SDK dies at startup:
Traceback (most recent call last):
File "/app/.venv/bin/my-function", line 10, in <module>
sys.exit(main())
File "/app/function/main.py", line 42, in main
runtime.serve(
...
File "/app/.venv/lib/python3.14/site-packages/crossplane/function/runtime.py", line 98, in serve
loop = asyncio.get_event_loop()
File "/usr/local/lib/python3.14/asyncio/events.py", line 718, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
% threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'MainThread'.
get_event_loop() creating a loop when none is running was deprecated in 3.12
and removed in 3.14; the call now only succeeds from inside a running loop.
How can we reproduce it?
Scaffold from function-template-python, set the base image to
python:3.14-slim, build, and run the entrypoint — the process exits
immediately with the traceback above. Nothing else is needed; it fails before
any request is served.
What is the SDK version?
crossplane-function-sdk-python 0.14.0 (current release), and main at the
time of writing still has the same call.
Why this may have gone unnoticed
pyproject.toml declares requires-python = ">=3.11", but CI pins a single
version — PYTHON_VERSION: '3.11' in .github/workflows/ci.yml — so nothing
exercises the upper end of that range. 3.13 still accepts the call (deprecated
only), which is why this surfaces first on 3.14.
Additional context
Found while testing a Python 3.12 → 3.14 bump on a function of ours. Worth
flagging how quiet the failure is: on 3.14 the image builds, every dependency
imports, and the full unit suite passes. Only starting the entrypoint fails, so
the bump looks green everywhere except in a cluster, where it crash-loops.
Happy to test a patch against a real function if that helps — not opening a PR
myself, since serve() also installs signal handlers and calls
run_until_complete on that loop, and how you want it restructured (own loop
via new_event_loop, or moving to asyncio.run) is a design call for you.
- Lenguaje dominante
- Python
- Estrellas
- 12
- Forks
- 15
- Merge medio
- 1 d 12 h
- PR fusionados (30 d)
- 7
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de crossplane/function-sdk-python
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 42/100
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
crossplane/function-sdk-python#199 · 4 comentarios · 3 reacciones ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
crossplane/function-sdk-python#129 · 1 comentario ·
-
Dependency Dashboard Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 10/100
Todos los issues de crossplane/function-sdk-python
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
canonical/paas-charm#368 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
tech debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
addition to tracking list Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
StevenBlack/hosts#3256 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
qualcomm/qai-appbuilder#275 ·