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

subprocess not killed when timeout fires

Abierto
#159 4 comentarios 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
32/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Empieza rastreando la gestión de los timeouts de pytest-timeout y cómo termina pytest en Windows; el issue no indica ningún archivo fuente ni ninguna prueba. Reproduce después el escenario de subprocess.Popen descrito en el issue y verifica que una prueba cuyo tiempo de espera se ha agotado no deje ningún proceso hijo y que el trabajo de GitLab termine.

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

Descripción

I've been using pytest-timeout for some time to catch whenever we have bad tests that just hang for a long time.
This doesn't happen very often and most of the time it happens locally and pytest-timeout saves the day.

We've been having an issue for some time when we run our tests in GitLab CI and a test ends up running for too long and then it's killed by pytest-timeout, The GitLab job hangs and eventually the GitLab runner crashes.

I debugged it today both locally and on GitLab and the issue I found is that we have a fixture where we open a server application using subprocess.Popen().
In the case where one of our tests takes too long and pytest is killed by pytest-timeout the subprocess remains open in the background.
Locally this isn't an issue because we cleanup any hanging processes at the start of our tests so they don't affect subsequent tests.
However in GitLab the job doesn't finish until all the processes are closed. Because the parent process is closed the GitLab runner isn't able to find any of the child processes and close those and everything hangs.

I'm running on Windows by the way.

So to get to my question, is there a way I can ensure that when pytest-timeout fires and kills pytest that it also kills any open subprocesses?

Thank you,

Alex

Lenguaje dominante
Python
Estrellas
260
Forks
69
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

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 pytest-dev/pytest-timeout

Todos los issues de pytest-dev/pytest-timeout

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.