[Bug]: Every page load of a Vite site waits 15s: dev-server check fails on IPv6 loopback ([::1])
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Lee DevServerBoot::devServerServing() y LaravelValetDriver::canConnect() en el controlador de Valet; el issue identifica el manejo del host IPv6 e incluye un comando PHP reproducible con fsockopen. Comprueba cómo viteServesSite() da formato a las URL IPv6 y luego verifica que las solicitudes a un sitio cuyo public/hot contiene http://[::1]:5173 ya no esperan 15 segundos. Se considera terminado cuando la comprobación del servidor de desarrollo tiene éxito y la página reportada carga con fluidez.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Platform
macOS
Operating system version
macOS 26.6.2
System architecture
ARM64 (M1, M2, etc)
Herd Version
2.0.3
PHP Version
8.5.12
Bug description
Since Herd 2.0, every browser page load of a Laravel site that uses Vite and has no public/build/manifest.json takes about 15 seconds, even though the site's Vite dev server is up and running.
Cause: LaravelValetDriver::ensureViteDevServer() keeps deciding that the dev server is not serving, so it holds the request (BOOT_AND_WAIT) for the full 15s deadline.
- Vite listens on the IPv6 loopback, so
public/hotcontainshttp://[::1]:5173(the default with Node 17+ on macOS, wherelocalhostresolves to::1). DevServerBoot::devServerServing()strips the brackets ($host = trim($host, '[]')) and passes::1toLaravelValetDriver::canConnect().canConnect()callsfsockopen('::1', 5173, ...). PHP can't resolve a bare IPv6 literal there (getaddrinfo for failed: nodename nor servname provided), so it always returnsfalse.fsockopen('[::1]', 5173)connects fine.- So
devServerServing()is alwaysfalse, the poll loop never succeeds, and every request waits until the deadline. The page then renders normally, because Vite really is serving.
For sites that do have a build manifest, the same false negative means every GET gets the BOOT action, so Herd is POSTed /ai/dev-ensure on each page load.
Measurements (same site, same URL, Vite running on [::1]:5173):
| Request | Time |
|---|---|
curl https://site.test/login (Accept */*, so the action is BOOT) |
0.07s |
curl -H 'Accept: text/html' https://site.test/login (BOOT_AND_WAIT) |
15.2s |
Same with the AI assistant disabled in herd.json |
0.07s |
A PHP backtrace taken from the FPM worker during the stall:
#1 usleep() .../valet/cli/Valet/Drivers/LaravelValetDriver.php:145
#2 Valet\Drivers\LaravelValetDriver->ensureViteDevServer() .../LaravelValetDriver.php:32
#3 Valet\Drivers\LaravelValetDriver->beforeLoading() .../valet/server.php:149
Suggested fix: keep the brackets for IPv6 literals when connecting, e.g. in canConnect():
$target = strpos($host, ':') !== false ? '['.$host.']' : $host;
$socket = @fsockopen($target, $port, $errno, $errstr, 0.15);
viteServesSite() already does this for the URL.
Workaround: disable the AI assistant (aiAssistant.enabled: false), which makes ensureViteDevServer() return early. Alternatively, make Vite listen on IPv4 (server.host: '127.0.0.1') so public/hot holds 127.0.0.1.
#1778 (Windows, "too slow after latest update") may be related, though I haven't checked whether this is the cause there.
Steps to reproduce
- Herd 2.0.3 on macOS with the AI assistant / Herd Studio enabled (the default).
- A Laravel site with
vite.config.jsand nopublic/build/manifest.json. - Run
npm run dev(or let Herd auto-start Vite).public/hotnow containshttp://[::1]:5173. - Load any page in the browser, or run
curl -H 'Accept: text/html' https://site.test/. Each request takes ~15s. - Check:
php -r 'var_dump(@fsockopen("::1", 5173));'givesfalse, andphp -r 'var_dump(@fsockopen("[::1]", 5173));'gives a resource.
Relevant log output
$ cat public/hot
http://[::1]:5173
$ php -r 'foreach (["::1", "[::1]"] as $h) { $s = @fsockopen($h, 5173, $en, $es, 0.15); echo $h, " => ", $s ? "OK" : "FAIL ($es)", PHP_EOL; }'
::1 => FAIL (php_network_getaddresses: getaddrinfo for failed: nodename nor servname provided, or not known)
[::1] => OK
- Lenguaje dominante
- Sin datos de lenguaje
- Estrellas
- 124
- Forks
- 1
- 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
- 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 beyondcode/herd-community
-
macOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
beyondcode/herd-community#1774 ·
-
[Bug]: PHP 8.3 php.ini missing auto_prepend_file and herd-ext extension lines (dump() undefined)AbiertomacOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
beyondcode/herd-community#1693 ·
-
macOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
beyondcode/herd-community#1602 ·
-
macOS
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
beyondcode/herd-community#1785 · 1 comentario ·
-
macOS
Dificultad 4/5 3-5 días Aptitud para principiantes 43/100
beyondcode/herd-community#1784 · 1 reacción ·
Todos los issues de beyondcode/herd-community
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
outline/outline#14348 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
get_lldp_neighbors_detail: query asks for 'max-address' (typo for 'mac-address'), so remote_chassis_id is always emptyPosiblemente ocupada @Jah-yee la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
[Bug]: Agent import retains quotes in .env API keys followed by inline commentsPosiblemente ocupada @yxr-2025 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
elie222/rakazo#2322 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
Bug-Report
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
RSS-Bridge/rss-bridge#5158 ·
Los mantenedores suelen responder en 1 día