[metro-file-map] On Windows, the file map watches every folder with its own handle
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, node.js
- Lĩnh vực
- tooling
Hướng nghiên cứu
Start with packages/metro-file-map/src/Watcher.js, watchers/NativeWatcher.js, and watchers/FallbackWatcher.js, then run the linked Windows reproduction to verify the handle count. The issue asks whether Windows should use NativeWatcher and whether that should be behind an option; clarify the approach and account for the listed Windows-specific edge cases before defining done.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Reproduction: https://github.com/YevheniiKotyrlo/metro-file-map-windows-watch-handles
On Windows, with Watchman off, metro-file-map opens one fs.watch handle for every folder under each watch root, node_modules included. Watcher picks WatchmanWatcher > NativeWatcher > FallbackWatcher (Watcher.js#L274-L279), NativeWatcher.isSupported() answers true only on macOS (NativeWatcher.js#L58-L60), and FallbackWatcher watches each folder it walks with fs.watch(dir, …) (FallbackWatcher.js#L193). One recursive fs.watch per root, as NativeWatcher makes on macOS, is backed on Windows by ReadDirectoryChangesW, which the comment above NativeWatcher names.
Steps (metro 0.87.2, and metro-file-map built from main at b8ac7a77a114ce1199c5e2b3ef2cca0a5b3d0aa8; Node 26.12.1, npm 12.2.1, Windows 11, PowerShell):
- Clone the reproduction and
npm install. It is a plain Metro project whosemetro.config.jssetsresolver.useWatchman: false. npx metro serve --port 8095, and wait forWelcome to Metro.- In a second window, read the server's handle count:
(Get-Process -Id (Get-NetTCPConnection -LocalPort 8095 -State Listen | Select-Object -First 1).OwningProcess).HandleCount. - In the project folder, count its folders, the project folder included:
(Get-ChildItem -Directory -Recurse -Force | Where-Object FullName -NotMatch '\\\.git(\\|$)').Count + 1.
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 project folder is the only watch root, so the watcher holds a handle or two for it, as one recursive fs.watch does.
Seen: the server holds one handle more for about every folder of the project:
metro-file-map |
server handles | project folders |
|---|---|---|
| 0.87.2 | 851 | 419 |
main b8ac7a77a |
866 | 434 |
main b8ac7a77a, with isSupported() also answering true on win32 |
432 | 434 |
The count grows with the project: a monorepo app of mine with 73 watch roots holds 28,378 handles once its Metro is ready.
The comment above NativeWatcher says it "could be used in principle" on Windows, "but needs work around some Windows-specific edge cases handled in FallbackWatcher, like deduping file change events, ignoring directory changes, and handling EPERM" (NativeWatcher.js#L46-L48). Would Metro take NativeWatcher on Windows with those cases handled, or behind an option first?
- Ngôn ngữ chính
- JavaScript
- Star
- 5.7k
- Fork
- 715
- Merge trung bình
- 3 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 77
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của react/metro
-
[metro-file-map] An error a watcher backend reports ends the server, since nothing listens for itCó thể đã có người làm @sorinc03 đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Resolver: Read `exports` from the package root, not the closest `package.json`Có thể đã có người làm @robhogan đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
react/metro#2153 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
metro-file-map gives up on a fallback watcher that is still starting after a fixed 240 s, and leaves it runningCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Published declarations import types from connect, @babel/core and @babel/traverse, whose @types packages are not dependenciesCó thể đã có người làm @sorinc03 đã nhận 3 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
curriculum documentation quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
githubnext/gh-aw-workshop#5367 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
HeyPuter/everything#187 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: Animal Planet BGĐang mởchannels:add check:passed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
Maintainer thường phản hồi trong vòng 4 ngày
-
beginner blocked
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
hiero-ledger/hiero-sdk-js#4670 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 61/100
Maintainer thường phản hồi trong vòng 1 ngày