facebook / facebook/watchman

In Docker: Django reloads for non project related 'changes'

Open
#865 4 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

### Environment:
- docker for mac (untested on non mac platforms) 2.4.0.0 (48506) stable channel
- docker base image `python3.6-slim`
- Django 3.1.2
- pywatchman 1.4.1
- watchman-v2020.09.21.00-linux, installed via binary, installed through root user
- project code is located in `/code` which is a bound docker volume to the project directory on my mac
- docker volumes `osxfs`-based, with `:delegated` option (see https://docs.docker.com/storage/bind-mounts/#configure-mount-consistency-for-macos)

I'm seeing Django autoreloading project code (in `/code`, remember) when an unrelated, non-project file (**NOT in `/code`**) is supposedly changed. Examples of this from Django's `runserver` output (see further below) are:
- `[django.utils.autoreload:236] [INFO]: /usr/local/lib/python3.6/xml/sax/__init__.py changed, reloading.`
- `[django.utils.autoreload:236] [INFO]: /opt/.pycharm_helpers/pycharm_matplotlib_backend/sitecustomize.py changed, reloading.`

```
api_1 | Watching for file changes with WatchmanReloader
api_1 | [django.utils.autoreload:613] [INFO]: Watching for file changes with WatchmanReloader
api_1 | Performing system checks...
api_1 |
api_1 | System check identified no issues (0 silenced).
api_1 | October 16, 2020 - 14:16:02
api_1 | Django version 3.1.2, using settings 'mydjango.settings.dev'
api_1 | Starting development server at http://0.0.0.0:8000/
api_1 | Quit the server with CONTROL-C.
...
api_1 | [16/Oct/2020 14:16:47] "GET /hr/v1/clients/?page=1&page_size=7&adjudication_status=PROSPECT&ordering=-last_updated&application__team__id=985f8cd3-4174-48e9-a99a-c5ca47be9f22 HTTP/1.1" 200 21009
api_1 | /usr/local/lib/python3.6/xml/sax/__init__.py changed, reloading.
api_1 | [django.utils.autoreload:236] [INFO]: /usr/local/lib/python3.6/xml/sax/__init__.py changed, reloading.
api_1 | Watching for file changes with WatchmanReloader
api_1 | [django.utils.autoreload:613] [INFO]: Watching for file changes with WatchmanReloader
api_1 | Performing system checks...
api_1 |
api_1 | System check identified no issues (0 silenced).
api_1 | October 16, 2020 - 14:17:17
api_1 | Django version 3.1.2, using settings 'mydjango.settings.dev'
api_1 | Starting development server at http://0.0.0.0:8000/
api_1 | Quit the server with CONTROL-C.
...
api_1 | [16/Oct/2020 14:33:16] "GET /api/v1/user_info/ HTTP/1.1" 200 11393
api_1 | /opt/.pycharm_helpers/pycharm_matplotlib_backend/sitecustomize.py changed, reloading.
api_1 | [django.utils.autoreload:236] [INFO]: /opt/.pycharm_helpers/pycharm_matplotlib_backend/sitecustomize.py changed, reloading.
api_1 | Watching for file changes with WatchmanReloader
api_1 | [django.utils.autoreload:613] [INFO]: Watching for file changes with WatchmanReloader
...
```

This appears to happen intermittently, and to be clear: these are files that are not changing. There is a pre-existing Django ticket about this (see https://code.djangoproject.com/ticket/31900) without resolution to date. I will link to this issue there as well. I hope a conversation can happen?

(Note that another user said that Watchman 4.9.0 did not exhibit this behaviour) **EDIT: confirmed, 4.9.0 works as expected.**

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.