Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watchman cannot start: path is too long #5107

Closed
scientificworld opened this issue Aug 9, 2024 · 10 comments
Closed

watchman cannot start: path is too long #5107

scientificworld opened this issue Aug 9, 2024 · 10 comments

Comments

@scientificworld
Copy link

Result from CocInfo

## versions

vim version: NVIM v0.10.1
node version: v22.6.0
coc.nvim version: 0.0.82-c5ffbb3c 2024-08-01 17:40:42 +0800
coc.nvim directory: /Users/scientificworld/.local/share/nvim/site/pack/packer/start/coc.nvim
term: iTerm.app
platform: darwin

## Log of coc.nvim

2024-08-09T20:00:29.823 INFO (pid:8165) [plugin] - coc.nvim initialized with node: v22.6.0 after 888
2024-08-09T20:00:29.828 INFO (pid:8165) [language-client-index] - Language server "html" started with 8167
2024-08-09T20:00:29.904 ERROR (pid:8165) [server] - uncaughtException Error: /opt/homebrew/bin/watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2024-08-09T20:00:29,899: [cli] w_stm_connect_unix(/var/folders/x3/6cjmpyss0xsgdw9d1f_8qfx40000gn/T/nvim.scientificworld/YevRgs/scientificworld-state/sock) path is too long
2024-08-09T20:00:29,899: [cli] unable to talk to your watchman on /var/folders/x3/6cjmpyss0xsgdw9d1f_8qfx40000gn/T/nvim.scientificworld/YevRgs/scientificworld-state/sock! (Argument list too long)

    at ChildProcess.<anonymous> (/Users/scientificworld/.local/share/nvim/site/pack/packer/start/coc.nvim/build/index.js:46347:22)
    at ChildProcess.emit (node:events:520:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
2024-08-09T20:00:34.918 INFO (pid:8165) [attach] - receive notification: showInfo []

The version of watchman is 2024.08.05.00, installed from Homebrew.

Describe the bug

When opening file outside the home directory, the error will be triggered.

Reproduce the bug

Change current directory and open any file.

Screenshots (optional)

截屏2024-08-09 20 16 30
@fannheyward
Copy link
Member

What's :CocCommand workspace.showOutput watchman when you run into this error?

coc.nvim will subscribe a pattern to watchman to monitor file changes, the Argument list too long error looks like the pattern matches too many files to watchman to work.

opening file outside the home directory

Can't understand this.

@scientificworld
Copy link
Author

What's :CocCommand workspace.showOutput watchman when you run into this error?

Seems output:///watchman is empty.

opening file outside the home directory

Can't understand this.

When the current working directory is my home directory, the error messages won't be displayed.

@scientificworld
Copy link
Author

coc.nvim will subscribe a pattern to watchman to monitor file changes, the Argument list too long error looks like the pattern matches too many files to watchman to work.

I guess the UNIX socket path is too long?

For example, watchman can start successfully with this command: watchman --foreground --logfile=/dev/stdout --sockname=/var/folders/x3/6cjmpyss0xsgdw9d1f_8qfx40000gn/T/nvim.scientificworld/YevRgs/scientificworld-state/soc

But not this: watchman --foreground --logfile=/dev/stdout --sockname=/var/folders/x3/6cjmpyss0xsgdw9d1f_8qfx40000gn/T/nvim.scientificworld/YevRgs/scientificworld-state/sock (results in a path is too long error)

Also, before I upgrade watchman from 2024.07.15.00 to 2024.08.05.00, this issue doesn't seem to occur. Strange.

@fannheyward
Copy link
Member

I'm using watchman 2024.08.12.00, can't reproduce this, working with macOS and watchman was installed from brew, the progress:

/opt/homebrew/bin/watchman --foreground --logfile=/var/folders/7q/r_8_1r5d5bb0dfycljk5pr1h0000gn/T/nvim.fannheyward/XexQzw/fannheyward-state/log --log-level=1 --sockname=/var/folders/7q/r_8_1r5d5bb0dfycljk5pr1h0000gn/T/nvim.fannheyward/XexQzw/fannheyward-state/sock --statefile=/var/folders/7q/r_8_1r5d5bb0dfycljk5pr1h0000gn/T/nvim.fannheyward/XexQzw/fannheyward-state/state --pidfile=/var/folders/7q/r_8_1r5d5bb0dfycljk5pr1h0000gn/T/nvim.fannheyward/XexQzw/fannheyward-state/pid

@vdumitraskovic
Copy link

@scientificworld I have the same problem on MacOS. Homebrew formula is changed so that default statedir is empty. That's why it started happening from while ago.

Here is the change I suspect is the culprit:
Homebrew/homebrew-core@98431a5#diff-c78c3d87f62f7c863480106785162f6a8daa6bf54168c63be347dc99cf8380bdL58

@scientificworld
Copy link
Author

I'm using watchman 2024.08.12.00, can't reproduce this, working with macOS and watchman was installed from brew, the progress:

/opt/homebrew/bin/watchman --foreground --logfile=/var/folders/7q/r_8_1r5d5bb0dfycljk5pr1h0000gn/T/nvim.fannheyward/XexQzw/fannheyward-state/log --log-level=1 --sockname=/var/folders/7q/r_8_1r5d5bb0dfycljk5pr1h0000gn/T/nvim.fannheyward/XexQzw/fannheyward-state/sock --statefile=/var/folders/7q/r_8_1r5d5bb0dfycljk5pr1h0000gn/T/nvim.fannheyward/XexQzw/fannheyward-state/state --pidfile=/var/folders/7q/r_8_1r5d5bb0dfycljk5pr1h0000gn/T/nvim.fannheyward/XexQzw/fannheyward-state/pid

Maybe my username is longer so it reaches the length limit of socket path.

@scientificworld
Copy link
Author

@scientificworld I have the same problem on MacOS. Homebrew formula is changed so that default statedir is empty. That's why it started happening from while ago.

Here is the change I suspect is the culprit: Homebrew/homebrew-core@98431a5#diff-c78c3d87f62f7c863480106785162f6a8daa6bf54168c63be347dc99cf8380bdL58

Thank you, after I revert the changes and rebuild from source, it works again!

Shall this be reported to Homebrew?

@fannheyward
Copy link
Member

Closes this as it's not coc.nvim's issue.

@vdumitraskovic
Copy link

@scientificworld I created an issue in the Homebrew repo. Hopefully, it will be resolved quickly.

Homebrew/homebrew-core#181152

@carlocab
Copy link

A workaround while we work out a proper fix is to do

export TMPDIR=/tmp

Note that this workaround is insecure on multi-user systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants