You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Docker: watcher hangs indefinitely and locks filesystem in unprivileged LXC #179
Info:
Running in Debian 13 unprivileged LXC container.
Reproduction steps:
Create an unprivileged LXC container with a directory bind-mounted from your host.
Install Docker on the LXC.
Pull the adibhanna/zennotes image (latest as of 6/14/26 in my case)
Run the zennotes Docker image with the /workspace directory set to somewhere in the directory bind-mounted from the host in step 1.
Result:
The docker image partially hangs, serving the webpage but not responding to docker kill, kill -9 <PID>, or anything short of restarting the docker daemon or LXC host itself. The bound volume on the host is also locked while zennotes is running in this state.
Expected result:
The container starts cleanly, or exits with a non-zero status and a clear error message, or degrades gracefully without locking the filesystem.
Suspected issue:
The hang appears to originate in apps/server/watcher/watcher.go. fsnotify.NewWatcher() or the subsequent fsw.Add() calls in Start() block indefinitely rather than returning an error under unprivileged LXC, where inotify is restricted. Errors from fsw.Add() are currently discarded (_ = fsw.Add(path)), so even a non-blocking failure would be silent. A graceful fallback to polling or a no-op watcher should resolve this issue.
Fixed in cbbbe76 (on release/v2.4.0, shipping in 2.4.0). Your diagnosis was spot on — pointing at watcher.go, the discarded _ = fsw.Add(path) errors, and the no-op-watcher suggestion made this straightforward.
I can't reproduce a kernel-level D-state hang outside an unprivileged LXC, so rather than guess at the inotify internals I implemented the graceful degradation you proposed, plus made the watcher non-fatal and gave the silent failures a voice:
ZENNOTES_DISABLE_WATCHER=1 → a true no-op watcher: no fsnotify.NewWatcher, no fsw.Add, no tree walk. The vault is still fully served; you only lose live auto-refresh. Because it never makes the inotify syscalls, it sidesteps the wedge entirely — the container stays killable and the bind-mount won't lock. This is the recommended setting for unprivileged LXC.
Never fatal: if the watcher can't start it now logs a warning and falls back to the no-op watcher instead of log.Fatal, so the server always comes up.
Surfaced errors: the initial walk now counts and logs fsw.Add failures (pointing you at the env var), and watching a newly created directory logs on error too.
Documented the variable and a "container hangs and won't stop" troubleshooting entry in the Docker how-to.
If you get a chance to try ZENNOTES_DISABLE_WATCHER=1 on your LXC setup, I'd love to confirm it resolves the hang for you. A polling-based watcher (so live updates still work without inotify) is a reasonable future enhancement if there's demand. Thanks again for the thorough report. 🙏
If you get a chance to try ZENNOTES_DISABLE_WATCHER=1 on your LXC setup, I'd love to confirm it resolves the hang for you. A polling-based watcher (so live updates still work without inotify) is a reasonable future enhancement if there's demand. Thanks again for the thorough report. 🙏
Thanks for the quick fix. The ZENNOTES_DISABLE_WATCHER=1 env var seems to have resolved the startup hanging, I'll give this version a try and see if any other issues surface!
Activity
Don't let the file watcher hang the server where inotify is restricted (
adibhanna commentedon Jun 16, 2026
Fixed in cbbbe76 (on
release/v2.4.0, shipping in 2.4.0). Your diagnosis was spot on — pointing atwatcher.go, the discarded_ = fsw.Add(path)errors, and the no-op-watcher suggestion made this straightforward.I can't reproduce a kernel-level D-state hang outside an unprivileged LXC, so rather than guess at the inotify internals I implemented the graceful degradation you proposed, plus made the watcher non-fatal and gave the silent failures a voice:
ZENNOTES_DISABLE_WATCHER=1→ a true no-op watcher: nofsnotify.NewWatcher, nofsw.Add, no tree walk. The vault is still fully served; you only lose live auto-refresh. Because it never makes the inotify syscalls, it sidesteps the wedge entirely — the container stays killable and the bind-mount won't lock. This is the recommended setting for unprivileged LXC.log.Fatal, so the server always comes up.fsw.Addfailures (pointing you at the env var), and watching a newly created directory logs on error too.Documented the variable and a "container hangs and won't stop" troubleshooting entry in the Docker how-to.
If you get a chance to try
ZENNOTES_DISABLE_WATCHER=1on your LXC setup, I'd love to confirm it resolves the hang for you. A polling-based watcher (so live updates still work without inotify) is a reasonable future enhancement if there's demand. Thanks again for the thorough report. 🙏Release v2.4.0 (#206)
Theroxenes commentedon Jun 20, 2026
Thanks for the quick fix. The
ZENNOTES_DISABLE_WATCHER=1env var seems to have resolved the startup hanging, I'll give this version a try and see if any other issues surface!Fix(server): watch subscribers no longer go silent 25 seconds after c…