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

Make container reuse safe across processes

Abierto
#1,553 0 comentarios 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
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
docker, node.js, typescript
Área
devtools, testing

Línea de trabajo

Read reuseOrStartContainer in packages/testcontainers/src/generic-container/generic-container.ts and the existing withFileLock implementation in packages/testcontainers/src/common/file-lock.ts. Check the tests for reusable container startup and run the relevant test suite with multiple processes to reproduce the race. Done means concurrent callers on the same host share one container; the issue notes that #1522 and #1552 also change this function, so coordinate around that overlap.

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

Descripción

enhancement minor

What happens

withReuse() looks for an existing container and creates one if there is none. That lookup-then-create is guarded by an in-process lock (AsyncLock), so two processes can both find nothing and both create a container.

Test runners commonly run test files in separate processes or workers. Starting the same reusable configuration from three processes at once created two containers. The extra one is never cleaned up, because reusable containers carry no session label.

Expected

Lookup-or-create is atomic across processes on the same host, so concurrent callers end up sharing one container.

Where

reuseOrStartContainer in packages/testcontainers/src/generic-container/generic-container.ts.

Notes

  • withFileLock in packages/testcontainers/src/common/file-lock.ts already serialises Ryuk and SSHD startup across processes. The same mechanism fits here.
  • Related: #1172, where the answer was to use the test runner's global setup. That remains the better fit for one shared container, but withReuse() is also used to keep containers between runs, where the race still applies.
  • Reproduced on main (aa60a746, 12.2.0) with Docker 29.6.1.

Dependencies

  • Stack on #1522, #1552: all three rewrite reuseOrStartContainer.
Lenguaje dominante
TypeScript
Estrellas
2.6k
Forks
274
Merge medio
1 d 14 h
PR fusionados (30 d)
44

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

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 testcontainers/testcontainers-node

Todos los issues de testcontainers/testcontainers-node

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.