howeyc/fsnotify

On Fedora 19, aborts with a "no space left on device" error

debrando opened this issue · 3 comments

After problems with Hot Code Reload of Revel on a fresh Fedora 19 installation, I tried the following test:

package main

import (
    "log"
    "github.com/howeyc/fsnotify"
)

func main() {
    log.Print("Creation of watcher")
    watcher, err := fsnotify.NewWatcher()
    if err != nil {
        log.Fatal(err)
    }
    log.Print("Watcher created")

    done := make(chan bool)

    // Process events
    go func() {
        for {
            select {
            case ev := <-watcher.Event:
                log.Println("event:", ev)
            case err := <-watcher.Error:
                log.Println("error:", err)
            }
        }
    }()

    log.Print("Start watching /tmp")
    err = watcher.Watch("/tmp")
    if err != nil {
        log.Fatal(err)
    }

    <-done
    log.Print("Done!")

    watcher.Close()
}

Output, with the same error found on Revel:

$ go run testwatcher.go
2013/10/10 14:31:50 Creation of watcher
2013/10/10 14:31:50 Watcher created
2013/10/10 14:31:50 Start watching /tmp
2013/10/10 14:31:50 no space left on device
exit status 1

Silly me, I was out of inotify watches! Was 8196, moved to 64k and all works fine:

sudo sysctl fs.inotify.max_user_watches=65536 | sudo tee -a /etc/sysctl.conf

Thanks, that helped me.