facebook / watchman

Watches files and records, or triggers actions, when they change.

Home Page:https://facebook.github.io/watchman/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ArindamRayMukherjee opened this issue · comments

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'`

  1. 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"}
  1. 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?

I have the same issue on linux.