facebook / facebook/watchman

Relay and Watchmen synchronization fail outright on Linux

Open
#1,271 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
13.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I am having issues with a yarn and React Native project and getting Relay and Watchmen to behave. So I made another example project to isolate it down to just watchmen, relay, and the bare minimum of what else was needed to have a project that runs. 

https://github.com/snelzing/Relay-and-Watchman-Practice-project

Even in this simple project, Watchmen fails to run and gets the same error. Here is the error (sorry it is long and gnarly, but I figured I needed to show the complete error)

This happens on Debian Bookworm, Linux Mint Una, and Ubuntu focal.

```
yarn run v1.22.22
$ relay-compiler --watch
[INFO] Querying files to compile...
[ERROR] Watchman error: The watchman server reported an error: "watchman::QueryExecError: query failed: synchronization failed: ", while executing command: QueryRequest(
    "query",
    "/workspaces/Relay-and-Watchman-Practice-project",
    QueryRequestCommon {
        glob: None,
        glob_noescape: false,
        glob_includedotfiles: false,
        path: Some(
            [
                RecursivePath(
                    "",
                ),
            ],
        ),
        suffix: None,
        since: None,
        relative_root: None,
        expression: Some(
            All(
                [
                    FileType(
                        Regular,
                    ),
                    Any(
                        [
                            All(
                                [
                                    All(
                                        [
                                            DirName(
                                                DirNameTerm {
                                                    path: "src",
                                                    depth: None,
                                                },
                                            ),
                                            Suffix(
                                                [
                                                    "js",
                                                    "jsx",
                                                ],
                                            ),
                                        ],
                                    ),
                                    Not(
                                        Any(
                                            [
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/node_modules/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/__mocks__/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/__generated__/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                            ],
                                        ),
                                    ),
                                ],
                            ),
                            Name(
                                NameTerm {
                                    paths: [
                                        "schema.graphql",
                                    ],
                                    wholename: true,
                                },
                            ),
                        ],
                    ),
                ],
            ),
        ),
        fields: [
            "name",
            "exists",
        ],
        empty_on_fresh_instance: false,
        omit_changed_files: false,
        fail_if_no_saved_state: false,
        case_sensitive: false,
        sync_timeout: Default,
        settle_period: None,
        settle_timeout: None,
        dedup_results: false,
        lock_timeout: None,
        request_id: None,
        always_include_directories: false,
    },
)
[ERROR] Compilation failed.
[ERROR] Unable to run relay compiler. Error details:
Watchman { source: WatchmanServerError { message: "watchman::QueryExecError: query failed: synchronization failed: ", command: "QueryRequest(\n \"query\",\n \"/workspaces/Relay-and-Watchman-Practice-project\",\n QueryRequestCommon {\n glob: None,\n glob_noescape: false,\n glob_includedotfiles: false,\n path: Some(\n [\n RecursivePath(\n \"\",\n ),\n ],\n ),\n suffix: None,\n since: None,\n relative_root: None,\n expression: Some(\n All(\n [\n FileType(\n Regular,\n ),\n Any(\n [\n All(\n [\n All(\n [\n DirName(\n DirNameTerm {\n path: \"src\",\n depth: None,\n },\n ),\n Suffix(\n [\n \"js\",\n \"jsx\",\n ],\n ),\n ],\n ),\n Not(\n Any(\n [\n Match(\n MatchTerm {\n glob: \"**/node_modules/**\",\n wholename: true,\n include_dot_files: false,\n no_escape: false,\n },\n ),\n Match(\n MatchTerm {\n glob: \"**/__mocks__/**\",\n wholename: true,\n include_dot_files: false,\n no_escape: false,\n },\n ),\n Match(\n MatchTerm {\n glob: \"**/__generated__/**\",\n wholename: true,\n include_dot_files: false,\n no_escape: false,\n },\n ),\n ],\n ),\n ),\n ],\n ),\n Name(\n NameTerm {\n paths: [\n \"schema.graphql\",\n ],\n wholename: true,\n },\n ),\n ],\n ),\n ],\n ),\n ),\n fields: [\n \"name\",\n \"exists\",\n ],\n empty_on_fresh_instance: false,\n omit_changed_files: false,\n fail_if_no_saved_state: false,\n case_sensitive: false,\n sync_timeout: Default,\n settle_period: None,\n settle_timeout: None,\n dedup_results: false,\n lock_timeout: None,\n request_id: None,\n always_include_directories: false,\n },\n)" } }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

 
```

I tried increasing the file watcher limit with 

`echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p` but no difference is made

I also tried `watchman watch-del-all` to no avail. Has anyone had similar issues with Relay and Watchmen on Linux?

I am also wondering if it is related to this issue at all, which I sometimes get:

https://github.com/facebook/relay/issues/3674

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.