Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/exp/inotify: silently ignores event queue overflow condition (IN_Q_OVERFLOW) #16392

Closed
ikruglov opened this issue Jul 16, 2016 · 2 comments
Closed

Comments

@ikruglov
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version go1.6.2 linux/amd64
  2. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/local/git_tree/gopath_third_party:/usr/local/git_tree/gopath:/usr/local/git_tree/gopath_third_party:/usr/local/git_tree/gopath"
GORACE=""
GOROOT="/usr/lib64/go"
GOTOOLDIR="/usr/lib64/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.
package main

import (
        "bytes"
        "io/ioutil"
        "log"
        "os"
        "strconv"
        "sync"
        "time"

        "golang.org/x/exp/inotify"
)

var dosleep = true

func main() {
        w, err := inotify.NewWatcher()
        if err != nil {
                log.Fatal(err)
        }

        if err := w.Watch("."); err != nil {
                log.Fatal(err)
        }

        var wg sync.WaitGroup
        wg.Add(1)

        go func() {
                for err := range w.Error {
                        log.Println(err)
                }
        }()

        go func() {
                for event := range w.Event {
                        if event.Mask&inotify.IN_Q_OVERFLOW == inotify.IN_Q_OVERFLOW {
                                log.Println("inotify.IN_Q_OVERFLOW")
                        }

                        if dosleep {
                                time.Sleep(time.Second)
                        }
                }
        }()

        go func() {
                b, err := ioutil.ReadFile("/proc/sys/fs/inotify/max_queued_events")
                if err != nil {
                        log.Fatal(err)
                }

                b = bytes.TrimSpace(b)
                queuesize, err := strconv.Atoi(string(b))
                if err != nil {
                        log.Fatal(err)
                }

                queuesize *= 2
                log.Println("iterating", queuesize, "times")
                for i := 0; i < queuesize; i++ {
                        if f, err := os.Create("_test"); err != nil {
                                log.Fatal(err)
                        } else {
                                f.Close()
                                os.Remove("_test")
                        }
                }

                log.Println("stop iterating, drain queue")
                dosleep = false
        }()

        wg.Wait()
}
  1. What did you expect to see?
    Either a error indicating that queue got overflowed or "inotify.IN_Q_OVERFLOW" message
  2. What did you see instead?
    nothing
@gopherbot
Copy link

CL https://golang.org/cl/24990 mentions this issue.

@quentinmit quentinmit changed the title exp/inotify: silently ignores event queue overflow condition (IN_Q_OVERFLOW) x/exp/inotify: silently ignores event queue overflow condition (IN_Q_OVERFLOW) Jul 20, 2016
@quentinmit quentinmit added this to the Unreleased milestone Jul 20, 2016
@rsc
Copy link
Contributor

rsc commented Oct 6, 2016

Deleted this code instead. See github.com/fsnotify for more maintained code.

@rsc rsc closed this as completed Oct 6, 2016
@golang golang locked and limited conversation to collaborators Oct 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants