Flaky test: daemon-pid-identity reads a just-spawned child's command line before exec

Abierto Apto para principiantes
#2,922 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
86/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
javascript, node.js
Área
testing

Línea de trabajo

Empieza por test/core/daemon-pid-identity.test.js, especialmente por liveChild y la prueba de la línea 58. Lee cómo la prueba inicia el proceso hijo y cómo se usa readProcessCmdline(pid), y luego haz que el helper espere hasta que el proceso hijo alcance la línea de comandos esperada antes de devolver su pid. El trabajo estará listo cuando ambas pruebas de identidad del daemon distingan de forma fiable las líneas de comandos previstas sin cambiar el código del producto.

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

Descripción

test/core/daemon-pid-identity.test.js:58 ("a daemon run command line is the daemon, whatever the program is called") failed once in the merge queue, on test (26). It was the only failure in the run, and it removed hyparam/hypaware#2920 from the queue. That PR touches no daemon or pid code, and the re-enqueue passed.

First sighting: merge-group run 42153366835 (2026-11-06T02:56:23Z, ubuntu, node 26).

test at test/core/daemon-pid-identity.test.js:58:1
✖ a `daemon run` command line is the daemon, whatever the program is called (2.197431ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

  null !== true

      at TestContext.<anonymous> (file:///home/runner/work/hypaware/hypaware/test/core/daemon-pid-identity.test.js:60:10)

Likely cause

The test spawns node -e 'setInterval(...)' daemon run and calls isDaemonProcess(child.pid) straight away, with no wait. On Linux, readProcessCmdline reads /proc/<pid>/cmdline, and isDaemonProcess returns null when that read throws or comes back empty. Right after spawn returns, the child can still be between fork and exec. In that window, /proc/<pid>/cmdline can read empty, so the result is null.

null is the intended fail-closed answer for an unreadable command line (LLP 0515 #identity), so the product code is right. The test assumes the child has already exec'd.

The neighboring test, "a live process without daemon run arguments is not the daemon", has the same race. But a pre-exec read there shows the parent's command line, which also gives false, so that test cannot fail this way.

Repro attempt

On a Linux seat with node 24.2, I ran 300 spawn-then-read loops with the test's exact spawn. All 300 read the daemon run command line, with no null. The window is narrow, and it showed up on a loaded CI runner.

Suggested fix (test only)

In liveChild, wait until the child has exec'd before returning its pid. For example, poll readProcessCmdline(pid) until it includes the expected arguments, with a short bounded deadline. Or have the child write one byte to stdout once it is running, and wait for that byte. No product change.

Lenguaje dominante
JavaScript
Estrellas
11
Forks
0
Merge medio
2 h 2 min
PR fusionados (30 d)
322

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 hyparam/hypaware

Todos los issues de hyparam/hypaware

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.