MagicStack / MagicStack/uvloop
Tests trying to find unused ports are flakey when automated
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Cython
- Estrellas
- 11.9k
- Forks
- 616
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
- uvloop version: 0.17.0
- Python version: 3.10
- Platform: nix/darwin
- Can you reproduce the bug with
PYTHONASYNCIODEBUGin env?: N/A - Does uvloop behave differently from vanilla asyncio? How?: N/A
The tests using find_free_port (like https://github.com/MagicStack/uvloop/blob/d2deffefa18653636eb03ea77a5dab6e4febf6c6/tests/test_tcp.py#L252) may fail in busy CI environments. For example building for nixpkgs involves running tests every time. It ends up with: (https://hydra.nixos.org/build/197525892/nixlog/1)
=================================== FAILURES ===================================
_______________________ Test_UV_TCP.test_create_server_5 _______________________
Traceback (most recent call last):
File "/private/tmp/tmp.xkcj6kx4o4/tests/test_tcp.py", line 245, in test_create_server_5
self.loop.run_until_complete(runner())
File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
File "/private/tmp/tmp.xkcj6kx4o4/tests/test_tcp.py", line 238, in runner
srv = await self.loop.create_server(
File "uvloop/loop.pyx", line 1790, in create_server
OSError: [Errno 48] error while attempting to bind on address ('::', 50000, 0, 0): address already in use
_______________________ Test_UV_TCP.test_create_server_6 _______________________
Traceback (most recent call last):
File "/private/tmp/tmp.xkcj6kx4o4/tests/test_tcp.py", line 271, in test_create_server_6
self.loop.run_until_complete(runner())
File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
File "/private/tmp/tmp.xkcj6kx4o4/tests/test_tcp.py", line 255, in runner
srv1 = await self.loop.create_server(
File "uvloop/loop.pyx", line 1790, in create_server
OSError: [Errno 48] error while attempting to bind on address ('::', 50000, 0, 0): address already in use
=============================== warnings summary ===============================
Do those tests need to use a common ipv4/6 socket? Could they use only one protocol at a time with port 0 and then get the local port number from the result?
Or maybe build the retry loop around the first socket creation rather than 2 independent steps?
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.
Línea de trabajo
Comienza en tests/test_tcp.py, especialmente en las pruebas que usan find_free_port alrededor de test_create_server_5 y test_create_server_6. Reproduce los fallos en un entorno automatizado u ocupado y, a continuación, evalúa el uso del puerto 0, de un socket IPv4/IPv6 compartido o de reintentar la creación del primer socket. La tarea estará terminada cuando las pruebas ya no fallen porque el puerto seleccionado ya está en uso.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- networking, testing
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100