python / python/cpython

`test_free_threading.test_monitoring` flaky (occasional reference leak)

Abierto
#136,692 8 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

3.13 3.14 3.15 tests topic-free-threading type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

Bug report

When running ./python -E -m test --timeout=2700 -R3:3 -u-cpu -j40 test_free_threading.test_monitoring -F, I get a failure every ~50-100 test runs:

0:00:36 load avg: 122.12 [ 55/1] test_free_threading.test_monitoring failed (reference leak)
beginning 6 repetitions. Showing number of leaks (. for 0 or less, X for 10 or more)
123:456
XX. 243
test_free_threading.test_monitoring leaked [2, 4, 3] memory blocks, sum=9

I think the issue is that we rely on Thread.is_alive() instead of joining the threads. I think there are still some objects that may not be freed until the thread is joined (like the handle):

https://github.com/python/cpython/blob/cb59eaefeda5ff44ac0c742bff2b8afc023be313/Lib/test/test_free_threading/test_monitoring.py#L65-L77

Linked PRs
  • gh-136896
  • gh-141832

Guía de contribución

Abrir la guía de contribución

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.

Línea de trabajo

Comienza por Lib/test/test_free_threading/test_monitoring.py alrededor de las líneas 65-77 y reproduce la fuga usando el comando del informe. Comprueba allí la limpieza de los hilos y luego vuelve a ejecutar la prueba repetida para confirmar que la fuga de referencias ya no se produce; los PR enlazados gh-136896 y gh-141832 indican que ese trabajo ya se ha trasladado a otro lugar.

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

Evaluación

Stack tecnológico
python
Área
operating-systems, testing-qa
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.