Automattic / Automattic/wp-codebox

Fail fast and clean up when Playground bind port is occupied

Aperta
#1,824 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
17
Fork
4
Merge medio
59m
PR unite (30g)
131

Descrizione

## Problem

A `recipe-run` selected a loopback port already held by an existing SSH listener. Playground emitted `listen EADDRINUSE`, but the run remained blocked in `input.materialize` until the outer 20-minute timeout sent SIGTERM. The managed disposable MySQL container remained running and required operator cleanup.

## Evidence

- Bind error: `listen EADDRINUSE: address already in use 127.0.0.1:63055`.
- The pre-existing owner was an SSH listener with PPID 1, started roughly 14 hours before the recipe run.
- Artifact pointer remained at `lastCommand: input.materialize` and recorded interruption by SIGTERM only when the outer timeout expired.
- The managed `wp-codebox-mysql-*` container remained up after termination.

## Expected

1. Dynamic Playground port allocation excludes ports that cannot be bound, or retries allocation on `EADDRINUSE`.
2. Runtime startup/materialization propagates the bind failure immediately instead of hanging.
3. Managed runtime services are torn down on this terminal startup failure and SIGTERM path.

## Reproduction

1. Hold a local TCP listener on a candidate Playground bind port.
2. Force or stub dynamic allocation to return that occupied port.
3. Run a recipe with a managed service and an input mount requiring materialization.
4. Assert the run fails promptly with structured bind diagnostics and the managed service lifecycle reaches `released`/`teardown: completed`.

Discovered while validating #1821 against a real mounted WPCOM PHPUnit recipe.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia riproducendo il caso di una porta loopback occupata con un servizio MySQL gestito, quindi traccia l’allocazione dinamica delle porte, l’avvio/materializzazione a runtime e il percorso di cleanup di SIGTERM. Il lavoro è completato quando la segnalazione strutturata del fallimento del bind è immediata, non si verifica alcun blocco della materializzazione e il servizio gestito raggiunge lo stato released/teardown: completato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
mysql, typescript
Ambito
backend, databases, devops
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.