facebook / watchman

Watches files and records, or triggers actions, when they change.
https://facebook.github.io/watchman/
MIT License
12.42k stars 989 forks source link

Watchman service is timing out waiting for a synchronization cookie file to be observed by the watcher within 20000 milliseconds #1157

Open ArindamRayMukherjee opened 11 months ago

ArindamRayMukherjee commented 11 months ago

My react-native/metro/watchman setup is not syncing changes to my JS code for the app.

Versions MacOS(Ventura 13.0) react-native(0.72) iOS simulator/metro(0.76.7) watchman(2023.08.07.00)

Symptoms

1) I run the app using react-native run-ios

2) Sometimes when the app comes up I see warnings like these(some other times I don't)

warning: Watchman `watch-project` returned a warning: Recrawled this watch 23 times, most recently because:
MustScanSubDirs UserDroppedTo resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del '/Users/arindamray/IdeaProjects/temp/DanceAppCopy' ; watchman watch-project '/Users/arindamray/IdeaProjects/temp/DanceAppCopy'`

3) In watchman logs I see the following appear every minute or so

2023-08-10T10:20:13,301: [client=8:stm=105553154998912:pid=60302] syncToNow: timed out waiting for cookie file to be observed by watcher within 20000 milliseconds
2023-08-10T10:20:13,303: [client=8:stm=105553154998912:pid=60302] PERF: {"user_time": 0.00058299999999999997, "start_time": 1691659193.2960839, "elapsed_time": 20.007055999999999, "version": "2023.08.07.00", "system_time": 0.0012650000000000001, "meta": {"sync_to_now": {"reason": "syncToNow: timed out waiting for cookie file to be observed by watcher within 20000 milliseconds: Operation timed out", "timeoutms": 20000, "success": false}, "root": {"recrawl_count": 0, "case_sensitive": false, "watcher": "fsevents", "path": "/Users/arindamray/IdeaProjects/temp/DanceAppCopy"}}, "pid": 60302, "description": "sync_to_now"}
2023-08-10T10:20:13,303: [client=8:stm=105553154998912:pid=60302] send_error_response: ["clock", "/Users/arindamray/IdeaProjects/temp/DanceAppCopy", {"sync_timeout": 20000}], failed: std::__1::system_error: syncToNow: timed out waiting for cookie file to be observed by watcher within 20000 milliseconds: Operation timed out
2023-08-10T10:20:13,304: [sanitychecks] Failed do_clock_check : Clock error : std::__1::system_error: syncToNow: timed out waiting for cookie file to be observed by watcher within 20000 milliseconds: Operation timed out
2023-08-10T10:20:13,304: [sanitychecks] PERF: {"user_time": 0.001052, "start_time": 1691659193.2959061, "elapsed_time": 20.008839999999999, "version": "2023.08.07.00", "system_time": 0.0021289999999999998, "meta": {"error": "Clock error : std::__1::system_error: syncToNow: timed out waiting for cookie file to be observed by watcher within 20000 milliseconds: Operation timed out", "root": {"path": "/Users/arindamray/IdeaProjects/temp/DanceAppCopy"}}, "pid": 60302, "description": "clock-test"}

4) On making a JS change to the app code - a) Pressing R on the metro terminal, most of the times the new changes are not reflected b) If I do not press R, on some occasions after about 30 seconds of making the change something starts to wake up and I see "Refreshing..." on the iOS simulator. Once that get's done, it seems metro is running two versions of the code(old and new), I see console log statements from both versions of the ocde. If now I press R on metro the new code starts to run. c) At times b above just does not happen and metro just keeps running the old code.

What could I be doing to fix/diagnose this?

Gruak commented 7 months ago

I have the same issue on linux.

zfrankdesign commented 6 months ago

Having a similar issue. Seemed to just randomly start happening. I tried restarting watchman no luck..

React Native - 0.72.6 Metro - 0.76.8 Watchman - 2023.09.18.00

Seeing this in my terminal where i run metro. Could it be from metro being on different version than RN, not sure if thats a thing?

Waiting for Watchman `query` (10s)...
Waiting for Watchman `query` (30s)...
Waiting for Watchman `query` (50s)...
Watchman `query` finished after 60.0s.
metro-file-map: Watchman crawl failed. Retrying once with node crawler.
  Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
  Error: Watchman error: watchman::QueryExecError: query failed: synchronization failed: syncToNow: timed out waiting for cookie file to be observed by watcher within 60000 milliseconds: Operation timed out. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.
smitbhatiya commented 3 months ago

Having a similar issue. Seemed to just randomly start happening. I tried restarting watchman no luck..

React Native - 0.72.6 Metro - 0.76.8 Watchman - 2023.09.18.00

Seeing this in my terminal where i run metro. Could it be from metro being on different version than RN, not sure if thats a thing?

Waiting for Watchman `query` (10s)...
Waiting for Watchman `query` (30s)...
Waiting for Watchman `query` (50s)...
Watchman `query` finished after 60.0s.
metro-file-map: Watchman crawl failed. Retrying once with node crawler.
  Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
  Error: Watchman error: watchman::QueryExecError: query failed: synchronization failed: syncToNow: timed out waiting for cookie file to be observed by watcher within 60000 milliseconds: Operation timed out. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.

have you solved that issue or not? because I am facing same issue please give the solution for it