Docker Community Forums

Share and learn in the Docker community.

Inotify events not triggering


(Cyph, Inc.) #1

Edit: Disregard this. Must be a sass bug, because inotifywait works exactly as expected. Thanks for the great work!

Second edit: Actually, maybe it isn’t necessarily a sass bug. It looks like inotifywait is only receiving ATTRIB events when it should be seeing CLOSE_WRITE events. Good enough for our purposes since our local environment scripts are written specifically to run on Docker and adapt to whatever quirks it may have, but if this is a bug then it’s probably worth fixing.

Expected behavior

sass --watch should work.

Actual behavior

sass --watch does not work.

Information

OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.0-beta8.2
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160427-185958.tar.gz
Most specific failure is: No error was detected
Your unique id is: 8AB3CD44-FDD7-4ABB-8F39-0831D1416973
Please quote this in all correspondence.

Steps to reproduce the behavior

Run a shell script in a Docker container with a sass --watch command.

Relevant bits from our code:

scssfiles="$(find css -name '*.scss' | grep -v bourbon/ | perl -pe 's/(.*)\.scss/\1/g')"
...
for file in $scssfiles ; do
	sass --watch $file.scss $file.css
done

(David Sheets) #2

This is a known limitation of our current inotify support. See https://beta.docker.com/docs/mac/osxfs/ for the list of supported and unsupported events. In particular, neither OS X file system event API, FSEvents or kqueue, supports file handle closure events and we did not have a compelling use case to pursue synthesis of IN_CLOSE_WRITE and similar events.

We have been tracking this topic using internal issue 1797 which covers support for:

  • IN_ACCESS
  • IN_CLOSE_WRITE
  • IN_CLOSE_NOWRITE
  • IN_OPEN

Given your use case with sass --watch, we will be re-prioritizing supporting IN_CLOSE_WRITE. Perhaps using a 250ms timeout after the last Modified event in OS X we can achieve a useful behavior.

Thanks for your report and participation in the Docker for Mac Beta!

Best regards,

David


(Cyph, Inc.) #3

Got it, sounds good; thanks for the info!

From a cursory grep of the sass source code, and then of the source of the rubygem that it apparently depends on for this called “listen”, it isn’t immediately obvious whether CLOSE_WRITE is required for this or whether ATTRIB should be sufficient. See:


(Hisa) #4

I have a similar issue.

When I save a file from VIM hot/live reloading works in the container. But when I save from Atom IDE or TextMate hot/live reloading doesn’t work, although the files change in the container.

Apparently inotify is only working from VIM or something.