Skip to content

File watcher not working on network file system #7420

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

Closed
zhengbli opened this issue Mar 7, 2016 · 7 comments
Closed

File watcher not working on network file system #7420

zhengbli opened this issue Mar 7, 2016 · 7 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@zhengbli
Copy link
Contributor

zhengbli commented Mar 7, 2016

Currently the file watcher cannot work properly on network file systems, or file systems that doesn't support the underlying change notification mechanism that node's fs.watch relies on. This could lead to the language service crashing (#6726).

The alternative solution is to consider third party file watcher libraries. As suggested by Daniel (#7376 (comment)), Watchman or similar product can be used for the purpose. It may worth some research.

@zhengbli zhengbli added the Bug A bug in TypeScript label Mar 7, 2016
@zhengbli zhengbli self-assigned this Mar 7, 2016
@zhengbli zhengbli added this to the TypeScript 2.0 milestone Mar 7, 2016
@DanielRosenwasser
Copy link
Member

For the record, there's a few things we should note about Watchman as a solution. From their Installation page:

Watchman relies on the operating system facilities for file notification,
which means that you will likely have very poor results using it on any
kind of remote or distributed filesystem.

Which sounds to me like you'll have sub-optimal results, but at least it won't crash. 😄

Additionally, their Windows support is in alpha stages (see facebook/watchman#19).

@zhengbli
Copy link
Contributor Author

zhengbli commented Mar 7, 2016

Actually the "operating system facilities for file notification" is the very thing that is lacking here, so that may be an issue too.

I wonder what VSCode uses for their own file watching, which may have considered this case already.

@zhengbli zhengbli removed this from the TypeScript 2.0 milestone Mar 7, 2016
@zhengbli zhengbli added the Revisit An issue worth coming back to label Mar 7, 2016
@zhengbli
Copy link
Contributor Author

zhengbli commented Mar 7, 2016

So I was trying to use a simple try/ catch to detect if fs.watch is available for the file, and if so use fs.watch, if not use time-stamp comparison. However, turns out sometimes node would simply crash (instead of throwing exceptions) why try to call fs.watch on a UNC path. Therefore this solution wouldn't work, and the support for network file system would be a non-trivial work item.

@wez
Copy link

wez commented Apr 6, 2016

You probably want to track this open item for watchman: facebook/watchman#201 if you're interested in better support for network shares.

@DanielRosenwasser
Copy link
Member

@wez thanks for the heads up!

@mhegazy
Copy link
Contributor

mhegazy commented Apr 26, 2016

@zhengbli should this be closed now after #8196?

@zhengbli
Copy link
Contributor Author

Yes I think so.

@mhegazy mhegazy closed this as completed Apr 26, 2016
@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed Revisit An issue worth coming back to labels Apr 26, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants