4

I got this warning when I ran goapp serve.

WARNING 2014-07-03 10:39:40,724 inotify_file_watcher.py:143] There are too many directories in your application for changes in all of them to be monitored. You may have to restart the development server to see some changes to your files

The cause maybe because of the npm_modules folder. I try to solve it using skip_files in app.yaml but the warning still exist.

skip_files:
- ^(.*/)?.*/node_modules/.*$
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$

What should I do?

1

7 Answers 7

7

Updated for current version of GAE's goapp serve watcher (_IGNORED_DIRS was replaced).

In .../appengine/tools/devappserver2/watcher_common.py, change

def skip_ignored_dirs(dirs):
  """Skip directories that should not be watched."""

  _remove_pred(dirs, lambda d: d.startswith(_IGNORED_PREFIX))

to

_IGNORED_DIRS = ('node_modules',)

def skip_ignored_dirs(dirs):
  """Skip directories that should not be watched."""

  _remove_pred(dirs, lambda d: d.startswith(_IGNORED_PREFIX) or d in _IGNORED_DIRS)
1

I solved it by editing one line in watcher_common.py located in go_appengine/google/appengine/tools/devappserver2.

_IGONERD_DIRS = ('.git', '.hg', '.svn', 'node_modules')
1

For the latest SDK 1.9.51 as of writing this answer, I just added node_modules to the _IGNORED_PREFIX variable.

_IGNORED_PREFIX = ('.', 'node_modules')

1

On Mac OS 10.14.5, running Google Cloud SDK 247.0.0, the skip_files variable in the app.yaml does not work for this. The only thing that worked for me, without changing the GAE code, was setting watcher_ignore_re to ignore the node_modules folder:

dev_appserver.py --google_analytics_client_id= --watcher_ignore_re=".*node_modules.*" ...

The --google_analytics_client_id= argument is necessary, otherwise it will throw an error saying the regular expression in watcher_ignore_re is not JSON serializable, as reported here

0

Changing the number of this variable _MAX_MONITORED_FILES solve my problem. I know that's not the best option but it worked. It was set 10000 and I've changed for 50000

0

In my case unseting my GOPATH solved the issue. I was using a global one with tonnes of stuff in there.

$ unset GOPATH
$ gcloud --version
Google Cloud SDK 148.0.0
app-engine-go 
app-engine-go-darwin-x86_64 1.9.50
app-engine-python 1.9.50

Also, see the related post on The Go Blog:

Until recently, the tools in the App Engine SDK were not aware of workspaces. Without workspaces the "go get" command cannot function, and so app authors had to install and update their app dependencies manually. It was a pain.

This has all changed with version 1.7.4 of the App Engine SDK. The dev_appserver and appcfg tools are now workspace-aware. When running locally or uploading an app, these tools now search for dependencies in the workspaces specified by the GOPATH environment variable.

0

In Linux, before you start your server run something like this:

sudo sysctl fs.inotify.max_user_watches=16000

In order, figure out the approximate right number for your situation go to your app dir and run:

find -L . | wc -l

to see how many files you have. Use a number slightly higher than what the command echoes.

Note1: You can see the original value by running the following to see what is the default in your operating system

cat /proc/sys/fs/inotify/max_user_watches

In my system the default is 8,192

Note2: This change goes away every time you reboot, there is a way to make it permanent as well, just search the web for 'max_user_watches'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.