Hugo server --watch not... er... 'watching"

Strange one this.

After working flawlessly for all the time I’ve been using Hugo, the --watch flag suddenly seems to have become unreliable.

I was working on a post today and noticed that hugo server --watch was not detecting edits I was making to the page. It would work for maybe the first edit [or perhaps two] and then would stop picking up further edits. If I used CTRL+C to quit the Hugo server and then started it again, the same pattern would repeat: it would pick up the first edit or two and then stop noticing them again.

Anybody else seen anything like this before?

The only thing I can think that I did differently from usual this time was to start by duplicating an existing post .md file using the Finder in OSX, rather than using hugo new blahblah.md. But surely that shouldn’t have made any difference. Doesn’t the --watch flag just monitor the entire site directory for changes? Otherwise how would it pick up edits to existing posts, as well as the current one?

VERSION: ``Hugo Static Site Generator v0.14 BuildDate: 2015-06-16T21:43:06+01:00```

I have the same issue with TextMate in OSX (there is an open Hugo issue about it). Try to do the same edits in TextEdit (or whatever), and see if that works.

Interesting.

I am using TextMate –but always have been, even when it was working flawlessly. I do seem to recall TextMate updating itself not too long ago though. So maybe that’s what did it.

See

Same here, using Brackets on OS X

I noted that on https://gohugo.io/overview/quickstart/

it says in Step 6 you don’t even have to use the --watch switch. But that isn’t the case, at least on OS X, and probably for the same reason it doesn’t work with the switch.

switched to another editor (TextSoap) and watch works fine.

I have submitted a patch to fsnotify. With this, watching works perfectly for me in Hugo with TextMate:

It is an obvious bug, so the merge shouldn’t be too long into the future …

I think there may be sometimes something wrong with the system notifications.

hugo serve (–watch) was working fine for me. Until today. I reinstalled older hugo version : sam behaviore, modifications weren’t seen by hugo (even with some older versions that i’m sure were okay previously). Even in --verbose mode, nothing dumped by hugo.

In the end i rebooted my server (x86 server running up-to-date LTS archlinux (4.9.28-1-lts)) (hadn’t been restarted for months …) and after that, everything is working again … (i can see the “INFO 2017/05/18 15:40:58 Received System Events:” logs)

So it seems that there may be some situations where notifications are not forwarded by the system to hugo … maybe something related to the unionfs ?

Ok, here’s the fun part.

15m ago, once server restarted, everywhing was working fine. 10 minutes later, --watch was not working again.

And the problem is … that i’m also running a seafile docker container on the same folder, watching for changes and uploading the modified files on a remote seafile server (so hugo watch was working until i restarted that container !).
If i stop that seafile (cli) container, then hugo start to see the notifications again.
It’s like if the notifications were only able to be sent to either the docker container, either hugo.

The weird part is that the seafile container is configured like that for months, and until recently, this wasn’t an issue. Maybe something has been altered in a recent docker version, i don’t know.

I am experiencing this problem as well on Linux Mint.

Up until today, everything was working fine. I am using VS Code. Then I ran updates on Mint. Since then, the watch feature does not work; even after restarting the machine. I also tried a different editor as suggested here. That also did not help.

OK, I think I managed to solve the problem (for now) by increasing the inotify max_user_watches settings as described here: https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

1 Like