You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Turbopack: Watch parent directories before watching children in non_recursive_helpers::start_watching_dir_and_parents (#82454)
Fixes a potential race condition #82130 (comment):
> I think there is a race condition here, when the child dir is created while we are walking the parent directories.
>
> 1. we try to watch /path/to/dir but it doesn't exist.
> 2. /path/to/dir is created
> 3. we move to the parent directory (`path/to`) and start watching it.
> 4. But we already missed the event that path/to/dir was created.
>
> I think we need to run the loop reverse direction, watching parent directories first before watching the child directories. This way we already have the parent directory watcher setup before "reading" the child directory (reading in the sense of starting to watch it).
Tested by putting a `println!()` in `start_watching_dir` and observing that the parents were watched first when running
```
rm -rf /tmp/fuzz && cargo run -p turbo-tasks-fuzz -- fs-watcher --fs-root /tmp/fuzz
```
0 commit comments