getPort ignores HOST, so a port in use on another interface forces a random PORT
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 75/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- node.js, typescript
- Área
- tooling
Línea de trabajo
Comienza en el punto de entrada getPort() utilizado por el servidor de desarrollo y node ace test, siguiendo tanto la rama de process.env.PORT como la derivada de .env. Reprodúcelo con HOST y PORT en interfaces de loopback separadas y verifica después que el puerto configurado se conserva cuando está libre en ese host y que las pruebas relevantes de assembler pasan.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Package: @adonisjs/assembler (seen on 7.8.2, still present in 8.5.2) with get-port 7.1.0
What happens
getPort() (used by the dev server and node ace test) calls:
getRandomPort({ port: Number(process.env.PORT) }) // no host
Without a host, get-port treats the port as taken if it is in use on undefined, 0.0.0.0 or any local interface address. So if port 3333 is bound on 127.1.1.63, node ace test configured with HOST=127.1.1.62 PORT=3333 is handed a random free PORT, even though 127.1.1.62:3333 is free.
The app then listens on 127.1.1.62:<random>. Anything that derives its URL from the configured port — typically a BASE_URL for supertest/@japa/api-client in functional tests — points at 127.1.1.62:3333 and every request fails with ECONNREFUSED.
Reproduce
- Alias a second loopback address (macOS:
sudo ifconfig lo0 alias 127.1.1.63). - Occupy the port there:
node -e "require('net').createServer().listen(3333, '127.1.1.63')" - In an Adonis app:
HOST=127.0.0.1 PORT=3333 NODE_DEBUG=adonisjs:core node ace test functional - The debug line shows
listening to utils http server, host :127.0.0.1, port: <random>, although127.0.0.1:3333is free.
Why it matters
Running several checkouts' test suites side by side on one machine — each on its own loopback IP and the same port — is a natural way to parallelise. The run that starts last loses the race and fails every HTTP test, and nothing in the output says why.
Suggested fix
Pass the configured host through, so availability is checked where the server will actually bind:
getRandomPort({ port: Number(process.env.PORT), host: process.env.HOST })
(and the same for the .env-derived branch). When HOST is unset, behaviour stays as today.
- Lenguaje dominante
- TypeScript
- Estrellas
- 40
- Forks
- 24
- Merge medio
- 10 d 22 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de adonisjs/assembler
-
Ctrl+C does not stop the dev server: raw mode suppresses SIGINT and close() never exits the processAbiertoStatus: Awaiting More Information
Dificultad 4/5 3-5 días Aptitud para principiantes 58/100
-
Support of typescript 7Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
-
OpenAPI schema generationQuizá libre de nuevo @thetutlage la tomó hace 92 días y no hay ningún pull request abierto. Abierto
Todos los issues de adonisjs/assembler
Issues similares
-
fix: txId branch of the contract-state streams drops every state after the named transactionAbiertobot:ai-assisted status:untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
midnightntwrk/midnight-js#1424 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
mksglu/context-mode#1268 ·
Los mantenedores suelen responder en 5 días
-
[bug] Setup fails with "Cannot find matching keyid" when an older Node's corepack is on PATHPosiblemente ocupada @EyalPoly la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
MystenLabs/MemWal#1124 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Edit:Abiertocheck:failed streams:edit
Dificultad 2/5 1-3 horas Aptitud para principiantes 60/100
iptv-org/iptv#54352 · 1 comentario ·
Los mantenedores suelen responder en 1 día