[metro-file-map] An error a watcher backend reports ends the server, since nothing listens for it
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, node.js
- Ambito
- tooling
Direzione di ricerca
Inizia da packages/metro-file-map/src/Watcher.js, in corrispondenza della sottoscrizione del backend a onFileEvent, poi leggi AbstractWatcher.js per vedere come vengono emessi gli errori del backend. L’issue suggerisce di sottoscriversi anche a onError del backend; usa la riproduzione collegata per verificare che venga segnalato un errore del watcher e che il server Metro continui a funzionare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Reproduction: https://github.com/YevheniiKotyrlo/metro-file-map-watcher-error
When a watcher backend reports an error, the Metro server exits. Watcher subscribes each backend it starts with onFileEvent only (Watcher.js#L332), and AbstractWatcher.emitError emits 'error' on the backend's own EventEmitter (AbstractWatcher.js#L87). With no 'error' listener, Node's EventEmitter throws the error, so any error a backend reports ends the process: here FallbackWatcher's .catch of a change it could not lstat (FallbackWatcher.js#L295), and as well the other emitError calls in FallbackWatcher and NativeWatcher, and a Watchman client error.
Steps (metro 0.87.2, and metro-file-map built from main at b8ac7a77a114ce1199c5e2b3ef2cca0a5b3d0aa8; Node 26.12.1, npm 12.2.1, Linux under WSL 2):
- Clone the reproduction and
npm install. It is a plain Metro project whoseindex.jsrequireswatched/value.js, and whosemetro.config.jssetsresolver.useWatchman: false. npx metro serve, and wait forWelcome to Metro.- In a second terminal, in the same folder,
chmod 000 watched.
For main: between steps 1 and 2, yarn install --frozen-lockfile and node scripts/build.js in a react/metro checkout, then node use-metro-main.js <the checkout>, which puts its packages/metro-file-map/build in place of the installed metro-file-map/src.
Expected: the watcher reports that it cannot read the folder, and the server goes on.
Seen, on 0.87.2 and on main alike: the server exits with code 1:
Error: EACCES: permission denied, lstat '…/metro-file-map-watcher-error/watched/watched'
at async Object.lstat (node:internal/fs/promises:1887:18)
at async #processChange (…/metro-file-map-watcher-error/node_modules/metro-file-map/src/watchers/FallbackWatcher.js:244:20)
Emitted 'error' event at:
at FallbackWatcher.emitError (…/metro-file-map-watcher-error/node_modules/metro-file-map/src/watchers/AbstractWatcher.js:77:19)
at …/metro-file-map-watcher-error/node_modules/metro-file-map/src/watchers/FallbackWatcher.js:212:25 {
errno: -13,
code: 'EACCES',
syscall: 'lstat',
path: '…/metro-file-map-watcher-error/watched/watched'
}
stopWatching() removes every listener (AbstractWatcher.js#L76), so an error reported while the watcher shuts down throws the same way. Subscribing the backend's onError beside its onFileEvent would let the file map report the error instead.
- Lingua principale
- JavaScript
- Stelle
- 5.7k
- Fork
- 711
- Merge medio
- 2g 18h
- PR unite (30g)
- 66
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di react/metro
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 2 giorni
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
mongoosejs/mquery#142 ·
-
Site Suggestion: bullseyeAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Add toro4n to the data modeling toolsForse già presa @henriklantzhedstrom-prog l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
neo4j/docs-getting-started#546 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 25 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
libnativeapi/nativeapi#21 ·